3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array('1'=>'a1','2'=>'a2'); $b = array('2'=>'b2'); var_dump($a+$b); var_dump($b+$a); var_dump(array_merge($a,$b)); var_dump(array_merge($b,$a));
based on qgvpJ
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
array(2) { [1]=> string(2) "a1" [2]=> string(2) "a2" } array(2) { [2]=> string(2) "b2" [1]=> string(2) "a1" } array(3) { [0]=> string(2) "a1" [1]=> string(2) "a2" [2]=> string(2) "b2" } array(3) { [0]=> string(2) "b2" [1]=> string(2) "a1" [2]=> string(2) "a2" }