I'm trying to sort my array values in descending order, but PHP sorted incorrectly. Here is my code example:
<?php $scores = array('98%','90%', '85%','100%','74%');
rsort($scores);
foreach($scores AS $key=>$val){
echo $key.'=>'.$val.'<br/>';
}
?>
And the result is:
0=>98%
1=>90%
2=>85%
3=>74%
4=>100%
But I want it to be like this:
0=>100%
1=>98%
2=>90%
3=>85%
4=>74%
I was also tried others sorting functions, but still cannot get the correct result.