sorting multi-dimensional arrays
| From: | Christian Dechery | Date: | Mon, 10 Sep 2001 03:51:22 +0000 |
| Subject: | sorting multi-dimensional arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67482@lists.php.net to get a copy of this message | ||
I'm having a little trouble sorting mult-dimensional arrays by key...
I looked-up the manual and found out that array_multisort() thing... but I don't think it does what I want... or I don't understand it...
I have an array like this...
$categories=array();
$categories[0]["id"]=1;
$categories[0]["name"]="Xyz";
$categories[0]["id"]=7;
$categories[0]["name"]="Lala";
$categories[0]["id"]=2;
$categories[0]["name"]="Lele";
I want it sorted by "name"... the way I'm doing it right now is by using an auxiliar array that gets all the names, sorts them, and then build a new array based on that...
is a better way?
p.s: meu novo email é cdechery@easynet.com.br
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer