##array_reverse
##(PHP 4, PHP 5, PHP 7)
—Returns an array with the cells in reverse order
##array_reverse(array$array[,bool$preserve_keys= FALSE] ) :array
array_reverse() accepts an array array as input and returns a new array with the cells in reverse order.
Parameters
array
Input array
preserve_keys
If set to TRUE, numeric keys will be retained. Non-numeric keys are not affected by this setting and will always be retained.Return value
Returns the reversed array.
Example
##Example #1array_reverse() example
``
Array ( [0] => php [1] => 4 [2] => Array ( [0] => green [1] => red ) ) Array ( [0] => Array ( [0] => green [1] => red ) [1] => 4 [2] => php ) Array ( [2] => Array ( [0] => green [1] => red ) [1] => 4 [0] => php )
PHP programming from entry to proficiency
The above is the detailed content of A direct look at the PHP array_reverse() function principle and example analysis. For more information, please follow other related articles on the PHP Chinese website!