I am trying to calculate rank based on grouping of score.
Here is the example of data, the actual data is dynamic. higher and lowest score depends on result value.
$data = array(
array('id' => 1, 'name' => 'John Snow', 'score' => 80),
array('id' => 2, 'name' => 'John Fire', 'score' => 50),
array('id' => 3, 'name' => 'John Water', 'score' => 79),
array('id' => 4, 'name' => 'John Leaf', 'score' => 80),
);
The result printout would be by id:
ID Name Score Rank
1 John Snow 80 1
2 John Fire 50 3
3 John Water 79 2
4 John Leaf 80 1
Thanks!