xref: /PHP-7.4/Zend/tests/add_001.phpt (revision 782352c5)
1--TEST--
2adding arrays
3--FILE--
4<?php
5
6$a = array(1,2,3);
7$b = array("str", "here");
8
9$c = $a + $b;
10var_dump($c);
11
12$a = array(1,2,3);
13$b = array(1,2,4);
14
15$c = $a + $b;
16var_dump($c);
17
18$a = array("a"=>"aaa",2,3);
19$b = array(1,2,"a"=>"bbbbbb");
20
21$c = $a + $b;
22var_dump($c);
23
24$a += $b;
25var_dump($c);
26
27$a += $a;
28var_dump($c);
29
30echo "Done\n";
31?>
32--EXPECT--
33array(3) {
34  [0]=>
35  int(1)
36  [1]=>
37  int(2)
38  [2]=>
39  int(3)
40}
41array(3) {
42  [0]=>
43  int(1)
44  [1]=>
45  int(2)
46  [2]=>
47  int(3)
48}
49array(3) {
50  ["a"]=>
51  string(3) "aaa"
52  [0]=>
53  int(2)
54  [1]=>
55  int(3)
56}
57array(3) {
58  ["a"]=>
59  string(3) "aaa"
60  [0]=>
61  int(2)
62  [1]=>
63  int(3)
64}
65array(3) {
66  ["a"]=>
67  string(3) "aaa"
68  [0]=>
69  int(2)
70  [1]=>
71  int(3)
72}
73Done
74