3v4l.org

run code in 300+ PHP versions simultaneously
<?php $amount = 4; @$a[5] += $amount; print_r($a); $b[6] = ($b[6] ?? 0) + $amount; print_r($b); @$c->x[5] += $amount; print_r($c); $d[3] = (isset($d[3]) ? $d[3] : 0) + $amount; print_r($d);
Output for 8.0.0 - 8.0.8
Array ( [5] => 4 ) Array ( [6] => 4 ) Fatal error: Uncaught Error: Attempt to modify property "x" on null in /in/tNV3s:7 Stack trace: #0 {main} thrown in /in/tNV3s on line 7
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.21
Array ( [5] => 4 ) Array ( [6] => 4 ) stdClass Object ( [x] => Array ( [5] => 4 ) ) Array ( [3] => 4 )

preferences:
677.02 ms | 461 KiB | 5 Q