[wp-trac] [WordPress Trac] #58012: Replace usage of strpos with str_starts_with
WordPress Trac
noreply at wordpress.org
Wed May 3 18:54:27 UTC 2023
#58012: Replace usage of strpos with str_starts_with
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| SergeyBiryukov
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.3
Component: General | Version:
Severity: normal | Resolution:
Keywords: good-first-bug has-patch 2nd- | Focuses:
opinion |
-------------------------------------------------+-------------------------
Changes (by flixos90):
* focuses: performance =>
Comment:
Replying to [comment:28 dd32]:
> I'm on the other side of the fence here, while this undoubtably makes
WordPress slower for the majority of PHP installs (Making this change odd
under the 'performance' tag), using more modern functions is beneficial
overall for coding practices.
How do you know that it makes WordPress sites slower? Are you referring to
most WP sites being on PHP<8? That would make sense to me. That said, in
the long term this will probably be beneficial for performance by using a
more targeted native PHP function.
Anyway, I agree this change has barely anything to do with performance. We
can be nit-picking as much as we want in either direction, but this is
about code patterns, like following the latest available PHP best
practices.
Maybe 1 of the 2 is an extremely tiny bit faster or slower than the other,
but in reality this will make close to zero difference for overall site
performance (the same way that for example removing 100 if clauses
somewhere is great, but still is too small of a change to ''actually''
impact performance.
I'll remove the performance focus as this is about code patterns, not
performance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58012#comment:40>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list