1--TEST--
2Test array_push() function : usage variations - multidimensional arrays
3--FILE--
4<?php
5/*
6 * Test array_push when passed:
7 * 1. an array as $var arg
8 * 2. as sub-array as $stack arg
9 */
10
11echo "*** Testing array_push() : usage variations ***\n";
12
13echo "\n-- Pass array as \$var argument --\n";
14$array = array(1, 2, 3);
15$sub_array = array('one', 'two');
16var_dump(array_push($array, $sub_array));
17var_dump($array);
18
19echo "\n-- Pass sub-array as \$stack argument --\n";
20var_dump(array_push($array[3], 'a'));
21var_dump($array);
22
23echo "Done";
24?>
25--EXPECT--
26*** Testing array_push() : usage variations ***
27
28-- Pass array as $var argument --
29int(4)
30array(4) {
31  [0]=>
32  int(1)
33  [1]=>
34  int(2)
35  [2]=>
36  int(3)
37  [3]=>
38  array(2) {
39    [0]=>
40    string(3) "one"
41    [1]=>
42    string(3) "two"
43  }
44}
45
46-- Pass sub-array as $stack argument --
47int(3)
48array(4) {
49  [0]=>
50  int(1)
51  [1]=>
52  int(2)
53  [2]=>
54  int(3)
55  [3]=>
56  array(3) {
57    [0]=>
58    string(3) "one"
59    [1]=>
60    string(3) "two"
61    [2]=>
62    string(1) "a"
63  }
64}
65Done
66