Re: [VOTE] str_icontains

From: Date: Tue, 01 Jul 2025 08:17:12 +0000
Subject: Re: [VOTE] str_icontains
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-127813@lists.php.net to get a copy of this message
On Tue, Jul 1, 2025 at 8:24 AM Tim Düsterhus <tim@bastelstu.be> wrote:

> Hi
>
> Am 2025-07-01 09:01, schrieb Adam Cable:
> > Voting just opened on the "str_icontains" RFC.
> >
> > Please find the following resources:
> >
> > RFC: https://wiki.php.net/rfc/str_icontains
> > Discussion: https://externals.io/message/127667
> > PR: https://github.com/php/php-src/pull/18705
>
> Thank you for your RFC. While I initially said “seems easy enough” in
> the PR and I also believe that making the function ASCII-only for
> consistency, I ultimately decided to vote against the RFC.
>
> My main reason is that I do not like how this function is added in a
> standalone fashion without a bigger picture. As mentioned in the PR,
> str_starts_with() and str_ends_with() are obvious companion
> functions.
>
> And ultimately calling strtolower() on both parameters before passing
> them to str_contains() is quite explicit in what it does (and would
> also resolve the Unicode vs ASCII confusion that others expressed).
> Alternatively stripos() would also work.
>
> Best regards
> Tim Düsterhus
>

Hi Tim,

Thanks for giving an explanation of your vote, thank you.
I had assumed that going with a small RFC for this would be easier than
trying to get str_starts/ends_with through at the same time, as noted in
the PR:

"I'll create a RFC for this, and if successful look to do the same with
str_starts_with and str_ends_with"

Thanks,
Adam


Thread (9 messages)

« previous php.internals (#127813) next »