It is useful to sort related data which is stored in an array alphabetical or numerical order, descending or ascending.
Some Sorting Array functions:
Print_r () function is a built-in function in PHP and is used to print or display information stored in a variable.
Some Example for Sorting array function:
Sort ():
Output: Array ([0] => Oil [1] => Spark Plugs [2] => Tires)
rsort () function is used for sorting the elements of the indexed array in descending order.
Output: Array ([0] => 10 [1] => 7 [2] => 4 [3] => 2.5 [4] => 2 [5] => 1)