3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(1=>1, 3=>3, 5=>5, 7=>7); $a = new ArrayObject($a); foreach ($a as $k => $v) { var_dump("$k => $v"); if ($k == 3) { $a['a'] = "?"; } } ?>
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
string(6) "1 => 1" string(6) "3 => 3" string(6) "5 => 5" string(6) "7 => 7" string(6) "a => ?"

preferences:
204.27 ms | 460 KiB | 5 Q