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));
Output for 5.6.38, 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
Array ( [First] => Array ( [Name] => John [Id] => 123 [Age] => 34 ) [Second] => Array ( [Name] => Peter [Id] => 45 [Age] => 34 ) )

preferences:
73.94 ms | 408 KiB | 5 Q