Re: [VOTE] Voting opens for str_starts_with and ends_with functions
| From: | Claude Pache | Date: | Tue, 09 Jul 2019 08:55:40 +0000 |
| Subject: | Re: [VOTE] Voting opens for str_starts_with and ends_with functions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106192@lists.php.net to get a copy of this message | ||
> Le 9 juil. 2019 à 09:40, Peter Bowyer <phpmailinglists@gmail.com> a écrit :
>
> On Mon, 8 Jul 2019 at 19:09, Björn Larsson <bjorn.x.larsson@telia.com>
> wrote:
>
>> Having this _ci postfix is a new way of indicating case insensitivity.
>> I think that it might add to negative votes. Personally I think it's a
>> good idea to mimic existing ways, even if they are a bit awkward.
>>
>> How about using a flag or following "tradition", like stri_starts_with
>> & stri_ends_with or str_istarts_with & str_iends_with? That would
>> follow strstr / stristr and str_replace / str_ireplace.
>>
>
> I would vote yes with that naming. It's a damn silly tradition, but it's
> what PHP uses for other functions, and keeping consistency is better than
> improving individual functions.
>
> Peter
There are currently (at least) two ways for marking case insensitivity in the name: the character
“i” as in stripos() and the substring “case” as in: strcasecmp().
Adding a third way, namely the “ci” suffix (or, even worse, a flag) is absolutely in the silly
tradition of inconsistent naming of PHP functions (although admittedly not one we should strive to
maintain)... except that “ci” is maybe more meaningful than “i” and “case”.
—Claude