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