src/GeneratorCollection.php
public function reduce(callable $callback, $initial = null)
    {
        foreach ($this->generator as $key => $value) {
            $initial = $callback($initial, $value, $key);
        }

        return $initial;
    }
public function reduce(callable $callback, $initial = null)
    {
        foreach ($this->generator as $key => $value) {
            $initial = $callback($initial, $value, $key);
        }

        return $initial;
    }
public function reduce ( callable $ callback , $ initial = null ) { foreach ( $ this -> generator as $ key => $ value ) { $ initial = $ callback ( $ initial , $ value , $ key ) ; } return $ initial ; }
Reduce the collection to a single value.

@param  callable $callback
@param  mixed $initial
@return mixed
Reduce the collection to a single value .