Re: [PHP-DEV] [RFC] [Discussion] array_match
[email protected] (Tim Düsterhus)
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
Hi
On 8/22/26 17:40, Ayesh Karunaratne wrote:
> I'm thumbs down on this for a few reasons.
>
> 1. We already have `str_contains` function. It is more intuitive that
> a false `strpos` call, and it makes an `array_filter` function clean
> too.
>
> ```php
> array_filter($values, static fn($value) => str_contains($value, 'foo'));
> ```
With PHP 8.6 this could even just be:
array_filter($values, str_contains(?, 'foo'));
Other than that, I agree with your email entirely.
Best regards
Tim Düsterhus