Code: Select all
$attack_values = array(0 => 12, 1 => 18, 2 => 15, 3 =>16); // ie. userid 0 has an attack value of 12, userid 1 has an attack value of 18 etc...
arsort($attack_values); // rank the users
$attack_values= array_flip($attack_values);I want to make a new array called $attack_ranks() mapping the userid to the element number from $attack_values that the userid occurred at.
Code: Select all
$attack_ranks = array();
$i = 0;
while ($i < 5) {
$attack_ranks[] = $attack_values[$i];
$i++;
}
foreach($attack_ranks as $key => $value)
{
echo "$key = $value<br/>";
}Thank you for any help.0 =
1 =
2 =
3 =
4 =
Shears