Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $results = array("098"=>90,"099"=>89,"100"=>77,"101"=>77);
- function getPosition($results,$StudentID){
- arsort($results);
- $index = 1;
- $exists = '';
- $keys = array_keys($results);
- foreach($keys as $key)
- {
- if($key == $StudentID)
- {
- $score = $results[$key];
- $position = $index;
- }
- $index++;
- }
- return $position;
- }
- echo getPosition($results,"098").'<br />';
- echo getPosition($results,"099").'<br />';
- echo getPosition($results,"100").'<br />';
- echo getPosition($results,"101").'<br />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement