note 15072 added to function.max.php
| From: | jesusjr at mindless dot com | Date: | Mon, 27 Aug 2001 08:55:04 +0000 |
| Subject: | note 15072 added to function.max.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17181@lists.php.net to get a copy of this message | ||
Be careful:
<?
$a = array(1,2,3,4,"5","N/A");
$b = array(1,2,3,4,'5','N/A');
echo "A: ".max($a)." : ";
echo "B: ".max($b)." : ";
echo (max($a)>0)?max($a):'max: 0';
?>
This will return:
A: N/A : B: N/A : Max: 0
I guess N/A (0/0) is equal to infinity (or >5), until it is compared to zero?
http://www.php.net/manual/en/function.max.php