method maxWithKey documentation in bbn\X
Returns the maximum value of a given property from a 2 dimensions array.
function(array $ar, $key)
{
if (\count($ar) == 0) {
return null;
}
$max = current($ar)[$key] ?? null;
if (!$max) {
return null;
}
foreach ($ar as $a) {
if (is_float($a[$key]) || is_float($max)) {
if (self::compareFloats($a[$key], $max, '>')) {
$max = $a[$key];
}
}
elseif ($a[$key] > $max) {
$max = $a[$key];
}
}
return $max;
}
Returns the maximum value of a given property from a 2 dimensions array. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions