I am trying to sort an array that is dynamically built.
The array looks like this:
$user_info["points"][$user_index] = 6;
$user_info["name"][$user_index] = "joe";
$user_info["account"][$user_index] = 54785;
$user_info["game1"][$user_index] = "buffalo";
$user_info["game2"][$user_index] = "newyork";
$user_info["game3"][$user_index] = "miami";
.
.
.
$user_info["gameX"][$user_index] = "x";
this array has an $user_index for each user.
I currently have 5 users....ie. 5 indicies.
I am trying to sort this associative based on points.
I am using the following function:
array_multisort ($user_info["points"], SORT_DESC, array_keys($user_info) );
but i am getting the message:
Warning: Array sizes are inconsistent in C:\Inetpub\wwwroot\Football_Pool\opponents_weekly_picks.php on line 115
I am able to sort only the "points" column by using:
array_multisort ($user_info["points"], SORT_DESC);
but cannot sort the entire array sucessfully.
You see the array columns are dynamic....ie. X (the number of games change from week to week) so I cannon simply use the following sort:
array_multisort ($user_info["points"], SORT_DESC, $user_info["name"][$user_index], $user_info["account"][$user_index], $user_info["game1"][$user_index], $user_info["game2"][$user_index], $user_info["game3"][$user_index],....$user_info["gameX"][$user_index]);
Because I do not know what X is....PLEASE HELP.
THANKS IN ADVANCE.