Re: Two new functions array_first() and array_last()

From: Date: Wed, 18 Oct 2023 18:55:54 +0000
Subject: Re: Two new functions array_first() and array_last()
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-121421@lists.php.net to get a copy of this message
Hi On 10/15/23 05:48, Saki Takamachi wrote:
I came up with the idea of ​​using a signature like array_filter(), and when a callback is passed, "return the first/last element that matches the condition" and "return null if there is no match."
This would be 'array_find()' and I would be in favor of it, with the caveat that I would want it to work with arbitrary iterables. See this previous thread regarding that topic: https://externals.io/message/118896#118896 Best regards Tim Düsterhus

« previous php.internals (#121421) next »