3v4l.org

run code in 200+ php & hhvm versions
<?php set_time_limit(1); $a = 'aaa'; foreach ($a['bbb'] as &$value) { echo 'loop'; } unset($value); echo 'done';
Output for 7.0.15, 7.1.1
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 hhvm-3.15.4
Fatal error: Uncaught Error: Operator not supported for strings in /in/YhlXN:7 Stack trace: #0 {main}
Process exited with code 255.
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