array_reverse
array array_reverse(array array)
Returns a copy of the original array in reverse order.
Returns:
Array in reverse order from the input array; NULL on failure
Description:
Creates a copy of the given array in reverse order, with key/value relationships intact. It returns the copy while leaving the original array untouched.
Version:
PHP 4 since 4.0b4
Example:
Reverse the order of an array's elements
$ax = array('a' => 'alpha', 'b' => 'bravo', 'c' => 'charlie', 'd' => 'delta');
$reversed = array_reverse($ax);
print_r($reversed);
Output:
Array
(
[d] => delta
[c] => charlie
[b] => bravo
[a] => alpha
)
|