What is the usage of the php array_reverse function?

The function array_reverse() is used to reverse the order of elements in an array. It will return a new array containing the elements of the original array, but in reverse order.

$input = array("a", "b", "c", "d");
$output = array_reverse($input);

print_r($output);

The output is:

Array
(
    [0] => d
    [1] => c
    [2] => b
    [3] => a
)
bannerAds