3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ "First" =>[ "Name" => "John", "Id" => 123 ], "Second" =>[ "Name" => "Peter", "Id" => 45 ] ]; $arr2 = [ "First" =>[ "Age" => 34, "Id" => 123 ], "Second" =>[ "Age" => 34, "Id" => 45 ] ]; print_r(array_replace_recursive($arr1, $arr2));

preferences:
23.82 ms | 405 KiB | 5 Q