Sorting an assoiative Array

From: Date: Mon, 09 Jul 2001 00:00:50 +0000
Subject: Sorting an assoiative Array
Groups: php.general 
Request: Send a blank email to php-general+get-56835@lists.php.net to get a copy of this message
Hi, I need to get the highest value of a hash. I first just wanted to do an arsort and then access the first value with $data[0], which didn´t work. I guess you can´t access associative arrays by index. So I found this way to do it (as the $data array needs to remain unchanged):
         $temp=$data;
         arsort ($temp);
         $max=reset($temp);
Is there really no shorter way to do it?? Pat

« previous php.general (#56835) next »