note 106144 modified in function.arsort by danbrown

From: Date: Thu, 13 Oct 2011 20:41:05 +0000
Subject: note 106144 modified in function.arsort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183867@lists.php.net to get a copy of this message
Needed to get the index of the max/highest value in an assoc array. max() only returned the value, no index, so I did this instead. <?php reset($x); // optional. arsort($x); $key_of_max = key($x); // returns the index. ?> --was-- Needed to get the index of the max/highest value in an assoc array. max() only returned the value, no index, so I did this instead. reset($x); // optional. arsort($x); $key_of_max = key($x); // returns the index. http://php.net/manual/en/function.arsort.php

« previous php.notes (#183867) next »