note 31130 deleted from function.array-multisort by aidan
| From: | aidan@php.net | Date: | Sun, 03 Oct 2004 10:56:29 +0000 |
| Subject: | note 31130 deleted from function.array-multisort by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77799@lists.php.net to get a copy of this message | ||
Note Submitter: php at richardNOSPAMneillPLEASE dot org dot uk
----
Array of Arrays are equivalent to many 1-D arrays with the same key.
I got very confused by trying to sort an array of arrays. I had an array $myarray[$i][$j] which I
wanted to sort in the i direction according to the value of $myarray[$i][0]. It took a long time to
realise that doing it this way is extremely muddled! It is much easier to have two arrays, as per
the post of Richard on 13 March 2002.
Using his example, I had an array $people, each of whose elements was a 2-element array
{participant-name, score} This is, in fact, equivalent, and at first, more obvious, but it's
the *wrong* way to do it!