Sorting multidimensional arrays
| From: | Sean Brown | Date: | Thu, 13 Feb 2003 22:30:18 +0000 |
| Subject: | Sorting multidimensional arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135532@lists.php.net to get a copy of this message | ||
Let's say I've got an array like so:
$myarray[0]["firstname"] = "Mickey";
$myarray[0]["lastname"] = "Mouse";
$myarray[0]["score"] = 20;
$myarray[1]["firstname"] = "Donald";
$myarray[1]["lastname"] = "Duck";
$myarray[1]["score"] = 10;
I'd like be able to sort the array using different dimensions before I
cycle through a while loop to print out the results. For instance, by
lastname, or by score. I can't seem to get array_multisort() to do it.
Any ideas?