update page now
PHP 8.1.34 Released!

Voting

: min(one, nine)?
(Example: nine)

The Note You're Voting On

wallfur at gmail dot com
1 year ago
If you need access to the keys of the array in your callback, this alternative uses the same signatures as array_reduce() and its callback, with the addition of a $key argument:
<?php
function array_reduce_assoc(array $array, callable $callback, mixed $initial = null): mixed
{
    foreach ($array as $key => $item)
    {
        $initial = call_user_func($callback, $initial, $item, $key);
    }
    return $initial;
}

<< Back to user notes page

To Top