Re: Adding in a case-insensitive version of str_contains

From: Date: Thu, 29 May 2025 21:00:00 +0000
Subject: Re: Adding in a case-insensitive version of str_contains
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
As I understand, it was a conscious decision not to add this function
when str_contains was created. The reason is that case sensitivity is
locale-dependent, and for such use cases, mbstring extension is better
[1] & [2]. Do you think that locale is a concern here, and if not,
why? Would it be a good idea to add mb_str_icontains instead?

If you're going to propose an RFC for this, it would be a good idea to
explain what the real life use case for it is. While str_contains is
very useful for checking the existence of a byte-string within another
byte-string, a case-sensitive check doesn't seem to have much use.

 [1]: https://stackoverflow.com/a/63121809/1839439
 [2]: https://wiki.php.net/rfc/str_contains#case-insensitivity_and_multibyte_strings


Thread (10 messages)

« previous php.internals (#127505) next »