Hi,

‪On Thu, 3 Sept 2026 at 17:21, ‫سپهر محمودی‬‎ <[email protected]> wrote:‬
>
> Hey internals,
>
> Just wanted to follow up with the real-world data I promised for 
> array_str_contains().
>
> I scanned the top 200 Composer packages (around 21,000 PHP files) to see how 
> people currently handle array substring searches. Here is what I found (32 
> matches total):
>
> - array_filter with str_contains: 8
> - array_filter with strpos: 8
> - array_filter with stripos: 6
> - foreach with str_contains: 6
> - array_filter with preg_match: 4
>
> All these different (and sometimes verbose) approaches can simply be replaced 
> with a single, clean, and fast native call:
> array_str_contains($haystack, $needle)
>
> I’ve updated the RFC with these findings:
> https://wiki.php.net/rfc/array_str_contains
>
> If you want to check out the script or raw JSON results, I uploaded them here:
> https://gist.github.com/sepehrphpr/d4d371ba682cc43c4f258de94684cc91
>
> Let me know what you think!
>
> Cheers,
> Sepehr
>

quick look in the RFC about this

"Non-string values in the array are implicitly cast to strings before
the check".

Is actually the case implementation wise ?

Reply via email to