Hello internals,
I'd like to present my first RFC - str_icontains, a case-insensitive friend
of str_contains
RFC: https://wiki.php.net/rfc/str_icontains
PR (including tests): https://github.com/php/php-src/pull/18705
Previous discussion: https://externals.io/message/127504
Thanks,
Adam
I'd like to present my first RFC - str_icontains, a case-insensitive
friend of str_containsRFC: https://wiki.php.net/rfc/str_icontains
PR (including tests): https://github.com/php/php-src/pull/18705
Just a +1 from my side. Looks good, useful and I've definitely caught
myself skipping the strtolower out of laziness and "it'll probably be
fine" in the past :)
Best,
Jordi
Hello internals,
I'd like to present my first RFC - str_icontains, a case-insensitive
friend of str_containsRFC: https://wiki.php.net/rfc/str_icontains
PR (including tests): https://github.com/php/php-src/pull/18705Previous discussion: https://externals.io/message/127504
Thanks,
Adam
When str_contains()
was added, a case-insensitive version was deliberately omitted in favor of "just use strtolower()
yourself." Have you gone back to see the arguments for that to determine if they're still relevant?
(I don't recall the details; I think one of them was function count explosion, but I think there were more.)
--Larry Garfield
2025年6月24日(火) 9:00 Larry Garfield larry@garfieldtech.com:
Hello internals,
I'd like to present my first RFC - str_icontains, a case-insensitive
friend of str_containsRFC: https://wiki.php.net/rfc/str_icontains
PR (including tests): https://github.com/php/php-src/pull/18705Previous discussion: https://externals.io/message/127504
Thanks,
AdamWhen
str_contains()
was added, a case-insensitive version was deliberately omitted in favor of "just usestrtolower()
yourself." Have you gone back to see the arguments for that to determine if they're still relevant?(I don't recall the details; I think one of them was function count explosion, but I think there were more.)
--Larry Garfield
Hi
I have concerns from multibyte(Unicode) user.
As someone who relies on Unicode, I feel that it is not worth using
that function.
str_contains can matches binary, so this is benefit of many reason,
but str_icontains is only support ASCII.
This only benefits some regions.
Regards
Yuya
--
Yuya Hamada (tekimen)