Arsort the array in descending order and maintains the index relationship.
Basic syntax
BOOL Arsort (array & $array [, int $sort _flags = sort_regular])
This function sorts the arrays in descending order, the index of the array remains and the cell is associated.
The Arsort function is primarily used to sort the associative arrays that are important for the cell order.
Parameter description:
Description
The Arsort () function reverses the array and maintains the index relationship. It is primarily used to sort the associative arrays that are important for the cell order.
The Second optional parameter contains an additional sort ID.
return value
Returns TRUE on success, or FALSE on failure.
Instance:
<?php$fruits = Array ("d" = "lemon", "a" = "orange", "b" = "banana", "c" = "apple"); Arsort ($fruits); Each ($fruits as $key = + $val) {echo "$key = $val <br/>";}? >
Operation Result:
A = Orange
D = Lemon
b = Banana
c = Apple