Re: RFC Karma Request
| From: | Christoph Becker | Date: | Wed, 27 Jul 2016 10:24:54 +0000 |
| Subject: | Re: RFC Karma Request | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94723@lists.php.net to get a copy of this message | ||
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