Php Array Element Reverse order Sort Function
What is rsort Function?
Explanation
The "rsort" function sorts an array elements in reverse order.
Syntax:
rsort(array,sorttype)
In the above syntax keys of the specified "array" will be changed. The parameter "sorttype" specifies the type in which to be sorted, for example "SORT_REGULAR", is the default type, "SORT_NUMERIC", treat values numerically, "SORT_STRING", treat values as strings, "SORT_LOCALE_STRING", treat values as string based on local settings.
Example :
<?php
$b=array("a"=>"Grapes","b"=>"Apple","c" =>"Cherry");
rsort($b);
print_r($b);
?>
Result :
[0] => Cherry
[1] => Apple
[2] => Grapes
In the above example the array "$b" is sorted in the reverse order,and the keys are changed. Now displays the values in reverse order.