Re: [PHP-DEV] [RFC] [Discussion] array_match

[email protected] (سپهر محمودی)
Newsgroups php.internals
Message-ID <CA+Jcf5vj1KjeqSeDO8mixvxeY5WbyfK_W4p=gO-hrPwzxUBJ+Q@mail.gmail.com>
در تاریخ یکشنبه ۲۳ اوت ۲۰۲۶، ۱۷:۵۸ Tim Düsterhus <[email protected]> نوشت:

> Hi
>
> On 8/22/26 21:31, سپهر محمودی wrote:
> > I have updated the RFC to reflect these changes (Version 0.3):
> > https://wiki.php.net/rfc/array_str_contains
>
> Please keep reusing the same Wiki page for the same RFC and do not
> create a new one when updating the RFC. It is confusing when the link in
> the email of the discussion thread is going to an outdated version of
> the RFC and it also effectively breaks the version history of the Wiki,
> which makes it hard to see what changed in the RFC.
>
> Basically creating a new Wiki page is equivalent to creating a new RFC
> entirely and that means it also needs to have a separate discussion
> thread according to policy.
>
> Best regards
> Tim Düsterhus
>


-------


Hi Tim,

You're absolutely right. The new syntax in PHP 8.6 makes using
`array_filter` incredibly clean and elegant, and I completely agree on the
readability aspect.

However, my main motivation for this RFC is performance. When dealing with
large arrays, the overhead of executing a callback (even a built-in one)
for every single element in `array_filter` can be quite significant. A
dedicated function implemented purely in C would bypass that overhead and
execute much faster.

Do you think the performance gain for such a common use-case justifies
having a dedicated function, or do you feel the language should strictly
prefer the `array_filter` approach despite the overhead?

Best regards,
Sepehr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.