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 33--EXPECTF-- 34*** Testing array_push() : basic functionality *** 35 36-- Push values onto an indexed array -- 37int(5) 38array(5) { 39 [0]=> 40 string(4) "zero" 41 [1]=> 42 string(3) "one" 43 [2]=> 44 string(3) "two" 45 [3]=> 46 string(5) "three" 47 [4]=> 48 string(4) "four" 49} 50 51-- Push values onto an associative array -- 52int(4) 53array(4) { 54 ["one"]=> 55 string(2) "un" 56 ["two"]=> 57 string(4) "deux" 58 [0]=> 59 string(5) "three" 60 [1]=> 61 string(4) "four" 62} 63Done