[wp-trac] [WordPress Trac] #58012: Replace usage of strpos with str_starts_with
WordPress Trac
noreply at wordpress.org
Thu Mar 30 03:21:13 UTC 2023
#58012: Replace usage of strpos with str_starts_with
----------------------------------------+------------------------------
Reporter: spacedmonkey | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: needs-patch good-first-bug | Focuses:
----------------------------------------+------------------------------
Comment (by ayeshrajans):
I'm in favor of this change too. Even if the performance difference is
minimal (and it is not like we run these functions millions of times
anyway), I think the code readability alone is a strong enough motivation
for this change.
Apart from `strpos` calls, I imagine we will have `preg_match` calls
without `/i` flag that could also be replaced with
`str_(starts_with|contains|ends_with)`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58012#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list