note 20640 deleted from function.min by didou

From: Date: Wed, 23 Jul 2003 01:28:15 +0000
Subject: note 20640 deleted from function.min by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52482@lists.php.net to get a copy of this message
Note Submitter: mike@hbhosting.com ---- 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; }

« previous php.notes (#52482) next »