summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/bug48854.phpt
blob: 7aaade03a4f3047b0b612e0b324eeaa7fb6f8f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--TEST--
Bug #48854 (array_merge_recursive modifies arrays after first one)
--FILE--
<?php

$array1 = array(
       'friends' => 5,
       'children' => array(
               'dogs' => 0,
       ),
);

$array2 = array(
       'friends' => 10,
       'children' => array(
               'cats' => 5,
       ),
);

$merged = array_merge_recursive($array1, $array2);

var_dump($array1, $array2);

?>
--EXPECTF--
array(2) {
  ["friends"]=>
  int(5)
  ["children"]=>
  array(1) {
    ["dogs"]=>
    int(0)
  }
}
array(2) {
  ["friends"]=>
  int(10)
  ["children"]=>
  array(1) {
    ["cats"]=>
    int(5)
  }
}