3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array1 = array("id1" => "value1","id3" => "value6"); $array2 = array("id2" => "value2", "id3" => "value3", "id4" => "value4"); $array3 = array_merge($array1, $array2/*, $arrayN, $arrayN*/); $array4 = $array1 + $array2; echo '<pre>'; var_dump($array3); var_dump($array4); echo '</pre>';
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre>array(4) { ["id1"]=> string(6) "value1" ["id3"]=> string(6) "value3" ["id2"]=> string(6) "value2" ["id4"]=> string(6) "value4" } array(4) { ["id1"]=> string(6) "value1" ["id3"]=> string(6) "value6" ["id2"]=> string(6) "value2" ["id4"]=> string(6) "value4" } </pre>