On 27.07.2016 at 02:55, Davey Shafik wrote:

> Ah, I missed that. If we had ranges (e.g. $string[0..4] or $string[-1..4])
> that'd work, but we don't.

However, that still would require something like

  $str[0..mb_strlen($needle)-1] == $needle

> Now I see some value in the function, though still perhaps not enough to
> justify above and beyond strpos etc.

One advantage of the new functions over userland implementations would
be efficiency.  A strpos() would still require to search the whole
string if the $needle is not found.  substr() and string slices would
require a copy unless that would be optimized, if a general optimization
is possible at all.

Not sure, if I like to see yet two more string functions in the global
namespace, though.

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to