array sort
| From: | Alex Black | Date: | Mon, 21 May 2001 22:19:28 +0000 |
| Subject: | array sort | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53785@lists.php.net to get a copy of this message | ||
hi all,
I'm trying to do an array sort that takes:
$test = array(
array( // this is $test[0].
string => "this is the second",
num => 2
),
array( // this is $test[1].
string=> "this is the first",
num => 1
),
);
and sorts that array based on $test[$x][num], so I get:
$test = array(
array( // this was $test[1], now $test[0].
string=> "this is the first",
num => 1
),
array( // this was $test[0], now $test[1].
string=> "this is the second",
num => 2
),
);
Note that the key/value pairs _must_not_ change, so I can't just copy this
stuff around to get what I want. (because I'm actually doing this for load
order of class instances)
so, I'm trying to sort the order of the top level arrays in a structure,
based on a key.
I played with array_moltisort, but could not get what I wanted out of it.
I have this nagging feeling like I _could_ get what I want out of it, thus
the post :)
oh yes, please cc me @ enigma@turingstudio.com
tia, all.
_alex