RE: Sorting multiple dimensional arrays
| From: | Tim Ward | Date: | Tue, 16 Oct 2001 07:55:59 +0000 |
| Subject: | RE: Sorting multiple dimensional arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71184@lists.php.net to get a copy of this message | ||
What you have (I assume) is an array each element of which is a 4 element
array. What I do in this situation is make another array copying the top
level one, with the key of each element being the field value you want to
sort on or, more safely, a composite of it and the original key to ensure
unique keys and allow you to re-extract the original key if you need it. You
can then do a ksort() or whatever on it.
Tim Ward
----------
From: Boget, Chris [SMTP:Chris.Boget@wild.net]
Sent: 15 October 2001 21:48
To: Php-General
Subject: Sorting multiple dimensional arrays
I've got a 4 (yes, 4) dimensional array. However, I only
want to sort on the third dimension only.
I've tried ksort() and array_multisort() but neither seem
to work. Tried a few of the other functions but they don't
seem to work, either.
Any suggestions? Hints?
Chris