Hi,

On Mon, Jul 8, 2019 at 4:54 PM Claude Pache <claude.pa...@gmail.com> wrote:
>
>
> > Le 8 juil. 2019 à 15:20, Christoph M. Becker <cmbecke...@gmx.de> a écrit :
> >
> > FTR, there is already substr_compare().
>
> `substr_compare()` (as well as `strncmp()` which I am currently using in lieu 
> of `str_starts_with()`) forces you to provides the substring and the length 
> of the substring, instead of just the substring:
>
>      substr_compare('foobarbaz', 'foo', 0, 3) === 0
>      strncmp('foobarbaz', 'foo', 3) === 0
>      str_starts_with('foobarbaz', 'foo')
>

The existence of substr_compare() and strncmp() is also my main
motivation for voting No, though I also share Zeev's reasoning.

You're right that the 2 already existing functions are a bit less
convenient to use, but the RFC doesn't even try to make a case for
that, so how do we know this was even considered? While I'm not
against having more than one way of doing things, I do think we need a
compelling enough reason to add a third way of doing the same thing
and here we don't even have an attempt to convince us.

Cheers,
Andrey.

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

Reply via email to