function reduce(callable $closure, $carry = null) {
        foreach($this->data as $val) {
            $carry = $closure($carry, $val);
        }
        
        return $carry;
    }
function reduce(callable $closure, $carry = null) {
        foreach($this->data as $val) {
            $carry = $closure($carry, $val);
        }
        
        return $carry;
    }
function reduce ( callable $ closure , $ carry = null ) { foreach ( $ this -> data as $ val ) { $ carry = $ closure ( $ carry , $ val ) ; } return $ carry ; }
Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
@param callable   $closure  Callback specification: `function ($carry, $value): mixed`
@param mixed|null $carry
@return mixed|null|void
Reduces the collection to a single value passing the result of each iteration into the subsequent iteration .