4 ms·
For anyone interested, you can actually make the startsWith and endsWith methods a lot faster by using strncasecmp or substr, like this: https://github.com/Nyc
by Nycto 15y ago
For anyone interested, you can actually make the startsWith and endsWith methods a lot faster by using strncasecmp or substr, like this:
https://github.com/Nycto/Round-Eights/blob/master/src/functions/strings.php#L319 https://github.com/Nycto/Round-Eights/blob/master/src/functi...
It could be a micro-optimization, but I find myself using these methods quite and it's a simple tweak to make.
- birken 15y agoThe string slicing would have been a lot more efficient had PHP accepted my patch to add this into the PHP core functions :) --> http://bugs.php.net/bug.php?id=54387 http://bugs.php.net/bug.php?id=54387 In general though we just use these around the code base for general use, and efficiency isn't a concern.
- deleted 15y ago[deleted]