3v4l.org

run code in 300+ PHP versions simultaneously
<?php $entities = [ 'deliveredAt' => null, 'issuedAt' => null, 'totals' => [ 'due' => null, 'gross' => null, 'net' => null, 'tax' => [ 'amount' => null, 'net' => null, 'rate' => null, ], ] ]; $realData = [ "issuedAt" => "2020-08-20", "totals" => [ "tax" => [ 'net' => 42, ] ] ]; print_r(array_replace_recursive($entities, $realData));
Output for 7.2.0 - 7.2.33, 7.3.0 - 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 ( [deliveredAt] => [issuedAt] => 2020-08-20 [totals] => Array ( [due] => [gross] => [net] => [tax] => Array ( [amount] => [net] => 42 [rate] => ) ) )

preferences:
86.87 ms | 407 KiB | 5 Q