...

View Full Version : array sorting



moiseszaragoza
01-17-2010, 06:53 PM
array sorting
I have a array that holds 2 values a userid and a score.

but i want to show the hiest scores on top.
but its not working. this is what i am trying

PHP Code:

$array_userid_score['score'][$count_userid_score] = 1;
$array_userid_score['users_id'][$count_userid_score] = 0;

$array_userid_score['score'][$count_userid_score] = 10;
$array_userid_score['users_id'][$count_userid_score] = 1;

$array_userid_score['score'][$count_userid_score] = 9;
$array_userid_score['users_id'][$count_userid_score] = 2;

$array_userid_score['score'][$count_userid_score] = 15;
$array_userid_score['users_id'][$count_userid_score] = 3;

$array_userid_score['score'][$count_userid_score] = 6;
$array_userid_score['users_id'][$count_userid_score] = 4;

asort ($array_userid_score);
But I am not getting it by the score

Thanks for the help

PappaJohn
01-17-2010, 07:16 PM
array_multisort() (http://us2.php.net/manual/en/function.array-multisort.php)

moiseszaragoza
01-18-2010, 02:31 PM
array_multisort() (http://us2.php.net/manual/en/function.array-multisort.php)

That was just what i needed



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum