note 103033 deleted from function.max by danbrown

From: Date: Tue, 22 Mar 2011 14:00:24 +0000
Subject: note 103033 deleted from function.max by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178086@lists.php.net to get a copy of this message
Note Submitter: habibalex at netzero dot com ---- You can use this code to return the key for the maximum value in an array. mick at wireframe dot com's solution works, he just forgot the 'current' keyword <?php $array = array(1, 2, 5, 7, 4); echo max($array); // 7 echo current(array_keys($array,max($array))); // 3 ?>

« previous php.notes (#178086) next »