check http://www.php.net/manual/en/function.asort.php
there's a routine someone wrote in the contributed section...
-jack
-----Original Message-----
From: Rick Dietz [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 1:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sorting Multidimensional Arrays
I'm having trouble finding a function to sort a multidimensional array by
the value of a given key in the contained arrays. Perhaps i'm missing
something, perhaps PHP is missing something.
Take the array below. All I'm looking to do is reorder $my_array based on
the value of the "name" key for example--to order $my_array based on the
alphabetical order of the "names".
$my_array = array (
array ("name"=>"Sam", "age"=>"20", married="yes"),
array ("name"=>"Alice", "age"=>"25", married="no"),
array ("name"=>"Jim", "age"=>"19", married="no"),
array ("name"=>"Janice", "age"=>"22", married="yes")
);
Am I missing something that already exists?
-Rick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]