Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions

From: Date: Mon, 08 Jul 2019 16:52:41 +0000
Subject: Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-106179@lists.php.net to get a copy of this message
Hi, On Mon, Jul 8, 2019 at 4:54 PM Claude Pache <claude.pache@gmail.com> wrote: > > > > Le 8 juil. 2019 à 15:20, Christoph M. Becker <cmbecker69@gmx.de> a écrit : > > > > FTR, there is already substr_compare(). > > substr_compare() (as well as 0¡á2ì�Ù½qÆF4 > Xßhstrncmp() 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.

« previous php.internals (#106179) next »