http://www.php.net/manual/en/function.usort.php

-----Original Message-----
From: Ben [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 11:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Sorting a multi-dimensional array


I have looked at array_multisort, asort, etc. NONE of them do what I need.

My array looks like this:

    $array[0][0] = First Id;
    $array[0][1] = First Name;
    $array[0][2] = First Rating;

    $array[1][0] = Second Id;
    $array[1][1] = Second Name;
    $array[1][2] = Second Rating;

    $array[2][0] = Third Id;
    $array[2][1] = Third Name;
    $array[2][2] = Third Rating;


Now, I want to sort the array (very very fast if possible cuz the array is
huge...150 such values) based on the "Rating" for each candidate, which is
the third column inside this matrix array. How should I ask PHP to do this?
Also, when I do sort by the Rating I want the ID and the name to remain the
same for each candidate, i.e., I want the indexes to be maintained.

HELP!

Thanks in advance
Ben



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to