I have an array.
What I want to do is sort the array (which I know how to do), but I also want to find what rank in the sort a certain key is . . .
Here is my example array:
$ArrayA=array(
'1'=>'45',
'5'=>'10',
'8'=>'60',
'17'=>'50',
'26'=>'25'
);
///// Sort & Ouput
arsort($ArrayA);
reset($ArrayA);
while (list ($key, $val) = each ($ArrayA)) {
echo "$key = $val<br>";
}
Will Ouput :
8 = 60
17 = 50
1 = 45
26 = 25
5 = 10
Now I want this script to finish by finding out what position in the array the $key is.
ie; $key=1 is in 3rd place.