Re: [RFC] [Discussion] array_match

From: Date: Sun, 23 Aug 2026 09:07:49 +0000
Subject: Re: [RFC] [Discussion] array_match
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-132298@lists.php.net to get a copy of this message
Am 22.08.2026 um 22:31 schrieb ⁨سپهر محمودی⁩ <⁨sepehrphpr@gmail.com⁩>: > Additionally, I have entirely removed the 3rd parameter ($ignore_caseå\üþÆôî6À > ÷ù"“–). You made a great point regarding the ASCII/Unicode complexities, and considering the > history with the rejected str_icontains RFC, it makes sense to drop > it and keep the behavior strictly aligned with str_contains(). > > I have updated the RFC to reflect these changes (Version 0.3): > https://wiki.php.net/rfc/array_str_contains Why not use preg_grep which basically does the same thing (and would support both case insensitivity and Unicode)? Sure, you need a delimiter and if you have special characters in your $needle then you need to use preg_quote but for all your examples but your function basically boils down to function array_str_contains($haystack, $needle) { return preg_grep('/' . preg_quote($needle, '/') . '/', $haystack); } I don't think it is worth adding this to the already quite large list of array_-functions. Regards, - Chris

« previous php.internals (#132298) next »