Re: sorting multi-dimensional arrays

From: Date: Mon, 10 Sep 2001 13:31:13 +0000
Subject: Re: sorting multi-dimensional arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67494@lists.php.net to get a copy of this message
it was just a typo... I meant: $categories[0]["id"]=2; $categories[0]["name"]="lele"; $categories[1]["id"]=6; $categories[1]["name"]="lala"; .. ... and so on... At 00:52 16/9/2001 -0400, you wrote:
The below code would result in an array of: $categories[0]["id"]=2; $categories[0]["name"]="Lele"; Please tell us the actual code you're using, or print_r($arrayname); /* Chris Lambert, CTO - chris@whitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ ----- Original Message ----- From: "Christian Dechery" <cdechery@easynet.com.br> To: <php-general@lists.php.net> Sent: Sunday, September 09, 2001 11:51 PM Subject: [PHP] sorting multi-dimensional arrays | 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 | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net | For additional commands, e-mail: php-general-help@lists.php.net | To contact the list administrators, e-mail: php-list-admin@lists.php.net | | |
p.s: meu novo email é cdechery@easynet.com.br ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer

« previous php.general (#67494) next »