note 20640 added to function.min

From: Date: Thu, 11 Apr 2002 04:27:45 +0000
Subject: note 20640 added to function.min
Groups: php.notes 
Request: Send a blank email to php-notes+get-29090@lists.php.net to get a copy of this message
Here is a replacement to min which should work just fine. (without the annoyance of undefined numbers messing it up!) function minnum($numarray){ //dont use min(), it contains a bug! $min=0; if(is_array($numarray)==true){ $min=$numarray[0]+1; for($z=0;$z<count($numarray);$z++){ if(is_int($numarray[$z])==true){ if($numarray[$z] < $min){$min=$numarray[$z];} } } } return $min; } -- http://www.php.net/manual/en/function.min.php http://master.php.net/manage/user-notes.php?action=edit+20640 http://master.php.net/manage/user-notes.php?action=delete+20640 http://master.php.net/manage/user-notes.php?action=reject+20640

« previous php.notes (#29090) next »