Arrays are just like the variable that store values but we can use arrays to store more than one value. Variable only store one value. There are three types of arrays
- Numeric arrays
- Associative array
- Multidimensional array
Sorting is a technique for the arrangement of element in a particular sequence. We can sort in ascending and descending order.
arsort () function in php:
This function is used to sort array in reverse order and keep their original values.
Reverse sort using arsort () function in php:
To sort function in reverse order we use arsort () function in php. Arsort () is a built-in function in php. This function takes array and type of sort as parameter and return sorted array in specific order.
$states = array("Delaware","Pennsylvania","New Jersey");
Above is a simple code to sort an array in reverse order for maintaining index association in PHP.
This simple article tells that how we sort an array in reverse order for maintaining index association in PHP.