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.26, 8.1.0 - 8.1.13
Array ( [deliveredAt] => [issuedAt] => 2020-08-20 [totals] => Array ( [due] => [gross] => [net] => [tax] => Array ( [amount] => [net] => 42 [rate] => ) ) )

preferences:
70.14 ms | 410 KiB | 5 Q