array_find, array_any and array_all

Four array functions that every project had written as helpers, finally in the language.

// before
$first = null;
foreach ($orders as $o) {
    if ($o->isOverdue()) { $first = $o; break; }
}

// 8.4
$first = array_find($orders, fn (Order $o) => $o->isOverdue());

$any = array_any($orders, fn (Order $o) => $o->isOverdue());
$all = array_all($orders, fn (Order $o) => $o->isPaid());
$key = array_find_key($orders, fn (Order $o) => $o->isOverdue());

array_any short-circuits, which is the difference from array_filter followed by a count and matters on a large array with an expensive predicate. The one to be careful with is array_all on an empty array, which is true — vacuously correct, occasionally surprising, and the source of the one test that failed when I replaced a hand-written helper that had returned false.