3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(1); $a = 'aaa'; foreach ($a['bbb'] as &$value) { echo 'loop'; } unset($value); echo 'done';
Output for 8.0.0 - 8.0.3
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/YhlXN:7 Stack trace: #0 {main} thrown in /in/YhlXN on line 7
Process exited with code 255.
Output for 7.0.15, 7.1.1, 7.2.29 - 7.2.33, 7.3.16 - 7.3.28, 7.4.0 - 7.4.16
Warning: Illegal string offset 'bbb' in /in/YhlXN on line 7 Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in /in/YhlXN:7 Stack trace: #0 {main} thrown in /in/YhlXN on line 7
Process exited with code 255.
Output for 7.1.0
Warning: Illegal string offset 'bbb' in /in/YhlXN on line 7
Process exited with code 137.
Output for 7.0.0 - 7.0.14
Warning: Illegal string offset 'bbb' in /in/YhlXN on line 7
Process exited with code 139.
Output for 5.6.0 - 5.6.30
Warning: Illegal string offset 'bbb' in /in/YhlXN on line 7 Warning: Invalid argument supplied for foreach() in /in/YhlXN on line 7 done