1--TEST-- 2Test array_reverse() function : basic functionality - simple 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() by giving a simple array for $array argument 12*/ 13 14echo "*** Testing array_reverse() : basic functionality ***\n"; 15 16// Initialise the array 17$array = array("a", "green", "red", '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(6) { 31 [0]=> 32 float(13.33) 33 [1]=> 34 int(10) 35 [2]=> 36 string(4) "blue" 37 [3]=> 38 string(3) "red" 39 [4]=> 40 string(5) "green" 41 [5]=> 42 string(1) "a" 43} 44array(6) { 45 [5]=> 46 float(13.33) 47 [4]=> 48 int(10) 49 [3]=> 50 string(4) "blue" 51 [2]=> 52 string(3) "red" 53 [1]=> 54 string(5) "green" 55 [0]=> 56 string(1) "a" 57} 58array(6) { 59 [0]=> 60 float(13.33) 61 [1]=> 62 int(10) 63 [2]=> 64 string(4) "blue" 65 [3]=> 66 string(3) "red" 67 [4]=> 68 string(5) "green" 69 [5]=> 70 string(1) "a" 71} 72Done 73