[wp-trac] [WordPress Trac] #22286: Enhancing backslashit performance
WordPress Trac
noreply at wordpress.org
Mon Nov 19 14:46:03 UTC 2012
#22286: Enhancing backslashit performance
-------------------------+------------------------------
Reporter: jbutkus | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Comment (by nacin):
`isset( $string{0} ) && $string{0} >= '0' && $string{0} <= '9'`
Stylistically, [0] should be used in lieu of the older {0}.
I'm thinking about ways to break this. PHP is usually really bad about
comparing things. In this case, it's a fun one. If $string[0] is "a", then
$string[0] >= '0' will be true. But, $string[0] <= '9' will be false. So
it does work, but it's fairly weird string-to-number behavior.
Is is_numeric() slower? Or maybe strpbrk?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22286#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list