3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = ['1' => 3, '2' => 1, '4' => 1]; $b = [1 => 1, 2 => 2, 3 => 1]; var_dump(array_replace($a, $b));
based on Aqa8l
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
array(4) { [1]=> int(1) [2]=> int(2) [4]=> int(1) [3]=> int(1) }