1--TEST-- 2Test array_push() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : int array_push(array $stack, mixed $var [, mixed $...]) 6 * Description: Pushes elements onto the end of the array 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Test basic functionality of array_push with indexed and associative arrays 12 */ 13 14echo "*** Testing array_push() : basic functionality ***\n"; 15 16$array = array ('zero', 'one', 'two'); 17$var1 = 'three'; 18$var2 = 'four'; 19 20echo "\n-- Push values onto an indexed array --\n"; 21var_dump(array_push($array, $var1, $var2)); 22var_dump($array); 23 24$array_assoc = array ('one' => 'un', 'two' => 'deux'); 25 26echo "\n-- Push values onto an associative array --\n"; 27var_dump(array_push($array_assoc, $var1, $var2)); 28var_dump($array_assoc); 29 30echo "Done"; 31?> 32--EXPECTF-- 33*** Testing array_push() : basic functionality *** 34 35-- Push values onto an indexed array -- 36int(5) 37array(5) { 38 [0]=> 39 string(4) "zero" 40 [1]=> 41 string(3) "one" 42 [2]=> 43 string(3) "two" 44 [3]=> 45 string(5) "three" 46 [4]=> 47 string(4) "four" 48} 49 50-- Push values onto an associative array -- 51int(4) 52array(4) { 53 ["one"]=> 54 string(2) "un" 55 ["two"]=> 56 string(4) "deux" 57 [0]=> 58 string(5) "three" 59 [1]=> 60 string(4) "four" 61} 62Done 63