3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function arrayReplace($a1, $a2) { foreach($a2 as $k=>$v) { $a1[$k]=$v; } return $a1; } $a1 = array(0 => 1, 1 => "b", "b" => "carrot"); $a2 = array(1 => "c", 2 => "d", "b" => "apple"); print_r(arrayReplace($a1, $a2));
Output for 4.3.0 - 7.2.0
Array ( [0] => 1 [1] => c [b] => apple [2] => d )