1--TEST-- 2Test array_unshift() function : basic functionality - array with default keys for 'array' argument 3--FILE-- 4<?php 5/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...]) 6 * Description: Pushes elements onto the beginning of the array 7 * Source code: ext/standard/array.c 8*/ 9 10/* 11 * Testing array_unshift() by giving array with default keys for $array argument 12*/ 13 14echo "*** Testing array_unshift() : basic functionality with default key array ***\n"; 15 16// Initialise the array 17$array = array(1, 2); 18 19// Calling array_unshift() with default argument 20$temp_array = $array; 21// returns element count in the resulting array after arguments are pushed to 22// beginning of the given array 23var_dump( array_unshift($temp_array, 10) ); 24 25// dump the resulting array 26var_dump($temp_array); 27 28// Calling array_unshift() with optional arguments 29$temp_array = $array; 30// returns element count in the resulting array after arguments are pushed to 31// beginning of the given array 32var_dump( array_unshift($temp_array, 222, "hello", 12.33) ); 33 34// dump the resulting array 35var_dump($temp_array); 36 37echo "Done"; 38?> 39--EXPECTF-- 40*** Testing array_unshift() : basic functionality with default key array *** 41int(3) 42array(3) { 43 [0]=> 44 int(10) 45 [1]=> 46 int(1) 47 [2]=> 48 int(2) 49} 50int(5) 51array(5) { 52 [0]=> 53 int(222) 54 [1]=> 55 string(5) "hello" 56 [2]=> 57 float(12.33) 58 [3]=> 59 int(1) 60 [4]=> 61 int(2) 62} 63Done 64