3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array1 = array(); $array2 = array(); $array1[0] = 'zero'; $array1[1] = 'one'; $array2[1] = 'one'; $array2[2] = 'two'; $array2[3] = 'three'; var_dump($array1 + $array2); var_dump(array_merge($array1 + $array2));
based on cqq46
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(4) { [0]=> string(4) "zero" [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" } array(4) { [0]=> string(4) "zero" [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" }