On Mon, 16 Mar 2026 at 15:32, Tim Düsterhus <[email protected]> wrote:
> 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 > Tim, Morgan Thanks for your comments. I did not realise that this would be easily implemented by using `array_any`. This means that the RFC that I was planning to create is not actually needed Cheers Carlos
