Re: RFC [Discussion]: array_find
| From: | Valentin Udaltsov | Date: | Fri, 24 May 2024 23:19:08 +0000 |
| Subject: | Re: RFC [Discussion]: array_find | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123427@lists.php.net to get a copy of this message | ||
On Sun, Apr 7, 2024, at 10:20 AM, Joshua Rüsweg wrote:
> Hi
> I have created an RFC to add the function array_find which returns the
> first element for which a predicate callback returns true. This is a
> function which I missed often. Furthermore this type of function is
> implemented with other programming languages like C++, JavaScript and Rust,
> too.
> You can find the RFC at:
> https://wiki.php.net/rfc/array_find
> Proof of concept implementation is in:
>
>
> https://github.com/joshuaruesweg/php-src/commit/9f3fc252b92f534d498e5f1e6a463e15f45da208ÇÈ_�„
> ¸
zƒö
–~z
> I'm looking forward to your feedback.
> Cheers
> Joshua Rüsweg
>
>
Hi, Joshua!
Have you considered renaming
$callback parameter to $predicate? I
always considered "callback" to be a very generic word. Predicate, on the
contrary, implies accepting a value and returning a bool.
--
Valentin Udaltsov