Array Sort Tricky
| From: | Matt Friedman | Date: | Fri, 15 Sep 2000 22:02:35 +0000 |
| Subject: | Array Sort Tricky | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16994@lists.php.net to get a copy of this message | ||
Hello!
I have an associative array where userID is the key, and each key contains
an array.
So, Score is array[0] and Date is array[1] (see below).
that is:
$arr[userID] = array(Score, Date);
Output looks like below:
UserID: 10
Score: 4
Date: 852105600
UserID: 12
Score: 5
Date: 852105600
UserID: 14
Score: 3
Date: 946713600
UserID: 16
Score: 3
Date: 852105600
I would like to order by score, and then order by Date, but ordering by date
must occur without messing up the order by score order.
So, the desired output would be:
UserID: 12
Score: 5
Date: 852105600
UserID: 10
Score: 4
Date: 852105600
UserID: 14
Score: 3
Date: 946713600
UserID: 16
Score: 3
Date: 852105600
Problem is, I don't know how to do it.
Any help?
Many thanks!
matt.