note 97120 modified in function.max by danbrown
| From: | danbrown@php.net | Date: | Fri, 02 Apr 2010 14:42:29 +0000 |
| Subject: | note 97120 modified in function.max by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167650@lists.php.net to get a copy of this message | ||
max only accepts not empty arrays.
if you work a lot with numerical arrays and with max, this function may come in handy:
<?php
if (!function_exists('emax')) {
function emax($arr) {
if (!is_array($arr)) return call_user_func_array('max', func_get_args());
if (count($arr) == 0) return 0;
return max($arr);
}
}
?>
--was--
max only accepts not empty arrays.
if you work a lot with numerical arrays and with max, this function may come in handy:
if (!function_exists('emax')) {
function emax($arr) {
if (!is_array($arr)) return call_user_func_array('max', func_get_args());
if (count($arr) == 0) return 0;
return max($arr);
}
}
http://php.net/manual/en/function.max.php