3v4l.org

run code in 500+ PHP versions simultaneously
<?php set_time_limit(1); $a = 'aaa'; foreach ($a['bbb'] as &$value) { echo 'loop'; } unset($value); echo 'done';

Abusive script

This script was stopped while abusing our resources

Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.11
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.1.1 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 7.0.15
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, 7.0.0 - 7.0.14
Warning: Illegal string offset 'bbb' in /in/YhlXN on line 7
Process exited with code 137.
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

preferences:
32.5 ms | 1179 KiB | 6 Q