array_reverse

array_reverse -- Return an array with elements in reverse order

Description

array array_reverse(array array);

array_reverse() takes input array and returns a new array with the order of the elements reversed.

Example 1. array_reverse() example

$input = array("php", 4.0, array("green", "red"));
$result = array_reverse($input);
      
This makes $result have array(array("green", "red"), 4.0, "php").

Note: This function was added in PHP 4.0 Beta 3.