I've been trying for a while but still, I'm stuck here. Actually I need to get rank from average values. Here my result
Average Rank
39 39 rank is 1
32 32 rank is 1
51 51 rank is 1
57 57 rank is 1
what I really need is
Average Rank
39 3
32 4
51 2
57 1
I've tried several method, but nothing seem to be works. Btw Here's my code
<?php $avg = ($sumc)/($data['total']); echo number_format((float)$avg, 2, ',', ''); ?>
<?php
$array = array($avg);
$i=1;
foreach($array as $key=>$value)
{
$max = max($array);
echo "
".$max." rank is ". $i."
";
$keys = array_search($max, $array);
unset($array[$keys]);
if(sizeof($array) >0)
if(!in_array($max,$array))
$i++;
}
See Question&Answers more detail:os