3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $myClass = [ 'attribute' => 0, 'method' => [ 'type' => 'static', 'accessibility' => 'public', 'code' => function () { echo($myClass['attribute']); } ] ]; function foo() { $bar = 'foo'; $baz = function () { echo($bar); }; $baz(); } $foo();
based on vFpuY
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: foo in /in/ghR5X on line 19 Fatal error: Uncaught Error: Function name must be a string in /in/ghR5X:19 Stack trace: #0 {main} thrown in /in/ghR5X on line 19
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Notice: Undefined variable: foo in /in/ghR5X on line 19 Fatal error: Function name must be a string in /in/ghR5X on line 19
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ghR5X on line 2
Process exited with code 255.