src/Component/Json.php
/**
     * Calls a function on each member of a countable and returns its first non-null return value.
     *
     * @param callable $function The function to be called on each member until returning a
     * non-null value, that accepts the following arguments:
     * 1. The element's value; might be gotten by-reference.
     * 2. The element's key.
     * 3. The parent element; might be gotten by-reference.
     * @param ?string|int $index
     * @return mixed
     */
Calls a function on each member of a countable and returns its first non-null return value.
@param callable $function The function to be called on each member until returning a
non-null value, that accepts the following arguments:
1. The element's value; might be gotten by-reference.
2. The element's key.
3. The parent element; might be gotten by-reference.
@param ?string|int $index
@return mixed
Calls a function on each member of a countable and returns its first non - null return value . @param callable $function The function to be called on each member until returning a non - null value that accepts the following arguments : 1 . The element ' s value ; might be gotten by - reference . 2 . The element ' s key . 3 . The parent element ; might be gotten by - reference . @param ?string|int $index @return mixed
public function forEach(callable $function, $index = null)
    {
        return $this->do(function (array &$array) use ($function) {
            foreach ($array as $key => &$value) {
                $result = $function($value, $key, $array);
                if ($result !== null) {
                    return $result;
                }
            }
        }, $index, true);
    }
public function forEach ( callable $ function , $ index = null ) { return $ this -> do ( function ( array & $ array ) use ( $ function ) { foreach ( $ array as $ key => & $ value ) { $ result = $ function ( $ value , $ key , $ array ) ; if ( $ result !== null ) { return $ result ; } } } , $ index , true ) ; }
Calls a function on each member of a countable and returns its first non-null return value.
Calls a function on each member of a countable and returns its first non - null return value .
// Returning the first non-null value