rsort
PHP -> Funkcie -> Array funkcie -> rsort
Syntax
void rsort(array arr);
Popis
Príkaz jazyka PHP
rsort - Sort an array in reverse order
This function sorts an array in reverse order (highest to lowest).
Príklad
/*
This example would display: fruits[0] = orange fruits[1] = lemon fruits[2] = banana fruits[3] = apple The fruits have been sorted in reverse alphabetical order.
*/
$fruits = array("lemon","orange","banana","apple");
rsort($fruits);
for (reset($fruits); list($key, $value) = each($fruits);) {
echo "fruits[$key] = ", $value, "\n";
}
This example would display: fruits[0] = orange fruits[1] = lemon fruits[2] = banana fruits[3] = apple The fruits have been sorted in reverse alphabetical order.
*/
$fruits = array("lemon","orange","banana","apple");
rsort($fruits);
for (reset($fruits); list($key, $value) = each($fruits);) {
echo "fruits[$key] = ", $value, "\n";
}
Pozri aj
arsort, asort, ksort, sort, usort