I was actually working on this sort of thing recently. _Technically_, you can support `all`, `any`, and `first` by using a single function:
function find_first(iterable $of, callable($value, $key): bool $thatSatistifes): Iterator It converts the $iterable into an Iterator, then calls the callback for each key/value pair until one returns true, and then always returns the iterator at the current position. 1. This allows you to know both key and value when making a decision. 2. By returning an iterator the caller can get both key and value. 3. By returning an iterator it can handle both the empty case and not found cases with $result->valid() === false. 4. By returning an iterator it might be useful for processing the remainder of the list somehow. I'm not sure that in practice it would be that friendly, but it's worth pointing out for discussion at least. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php