Sorting Multidimensional Associative arrays
| From: | Alex V. | Date: | Mon, 26 Jun 2000 22:06:11 +0000 |
| Subject: | Sorting Multidimensional Associative arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3219@lists.php.net to get a copy of this message | ||
I'm trying to sort a multidimensional asociative array.
The array looks like this:
$r[$user]['skill']
$r[$user]['age']
$r[$user]['experience']
is it possible to sort this array in such way that the first key of it
(user) is the user with the highest age number and the last user is the one
with lowest age number? That is.. an descending sorting of users by their
age.
If it were a mysql database. what i want is something like "SELECT user FROM
table ORDER BY skill DESC" but since it's an array and not a sql ... I have
no clue :)
You may ask.. why dont I have that info at an sql so I could make a simple
query... well, I might have some reasons for not doing it. but that's not
the point. so please if anyone knows how to sort the array.. any examples
would be really helpfully :))
Thanks in advance
Alex.