3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function func() { foreach (['item'] as $item) { class C { function f() { echo $item; } } } } $c = new C; $c->f();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'C' not found in /in/r3Jll:11 Stack trace: #0 {main} thrown in /in/r3Jll on line 11
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Class 'C' not found in /in/r3Jll on line 11
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/r3Jll on line 3
Process exited with code 255.