1--TEST-- 2Test array_reverse() function : basic functionality - associative array for 'array' argument 3--FILE-- 4<?php 5/* Prototype : array array_reverse(array $array [, bool $preserve_keys]) 6 * Description: Return input as a new array with the order of the entries reversed 7 * Source code: ext/standard/array.c 8*/ 9 10/* 11 * Testing array_reverse() with associative array for $array argument 12*/ 13 14echo "*** Testing array_reverse() : basic functionality ***\n"; 15 16// Initialise the array 17$array = array("a" => "hello", 123 => "number", 'string' => 'blue', "10" => 13.33); 18 19// Calling array_reverse() with default arguments 20var_dump( array_reverse($array) ); 21 22// Calling array_reverse() with all possible arguments 23var_dump( array_reverse($array, true) ); // expects the keys to be preserved 24var_dump( array_reverse($array, false) ); // expects the keys not to be preserved 25 26echo "Done"; 27?> 28--EXPECTF-- 29*** Testing array_reverse() : basic functionality *** 30array(4) { 31 [0]=> 32 float(13.33) 33 ["string"]=> 34 string(4) "blue" 35 [1]=> 36 string(6) "number" 37 ["a"]=> 38 string(5) "hello" 39} 40array(4) { 41 [10]=> 42 float(13.33) 43 ["string"]=> 44 string(4) "blue" 45 [123]=> 46 string(6) "number" 47 ["a"]=> 48 string(5) "hello" 49} 50array(4) { 51 [0]=> 52 float(13.33) 53 ["string"]=> 54 string(4) "blue" 55 [1]=> 56 string(6) "number" 57 ["a"]=> 58 string(5) "hello" 59} 60Done 61