Hi

Am 2026-03-16 01:41, schrieb Morgan:
For this extension, I'm not sure what the advantages are over simple function composition (array_any was introduced for exactly this sort of job and is applicable to any function)

I agree. Especially since the Partial Function Application RFC was accepted an ad-hoc implementation would just be:

    $str = 'bazinga';

$strStartsWithAny = \array_any(['foo', 'bar', 'baz'], \str_starts_with($str, ?));

I have also added an optimization to PHP 8.6 that compiles `array_map()` into a foreach loop when the callback is first class callable or PFA: https://github.com/php/php-src/pull/20934. I plan to extend this to the other array_* functions once the PFA PR is merged.

Best regards
Tim Düsterhus

Reply via email to