Syntax: max ()
Returns the maximum value in a sequence of values.
Syntax: max (selector {(v, k) ==> value})
Invokes a transform function on each element of a sequence and returns the maximum value.
public function max($selector = null) { $selector = Utils::createLambda($selector, 'v,k', Functions::$value); $max = -PHP_INT_MAX; $assigned = false; foreach ($this as $k => $v) { $max = max($max, $selector($v, $k)); $assigned = true; } if (!$assigned) { throw new \UnexpectedValueException(Errors::NO_ELEMENTS); } return $max; }