3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function autoloader() { var_dump($class); } spl_autoload_register('autoloader'); class foo { const X = bar::X; } var_dump(foo::X);
Output for 5.2.4 - 5.2.12, 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: class in /in/kZf4m on line 2 NULL Fatal error: Class 'bar' not found in /in/kZf4m on line 9
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: class in /in/kZf4m on line 2 NULL Fatal error: Class undefined: bar in /in/kZf4m on line 7
Process exited with code 255.
Output for 5.2.13 - 5.2.17
Notice: Undefined variable: class in /in/kZf4m on line 2 NULL Fatal error: Undefined class constant 'bar::X' in /in/kZf4m on line 9
Process exited with code 255.
Output for 5.1.0 - 5.2.3
Notice: Undefined variable: class in /in/kZf4m on line 2 NULL Notice: Use of undefined constant bar::X - assumed 'bar::X' in /in/kZf4m on line 9 string(6) "bar::X"
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function spl_autoload_register() in /in/kZf4m on line 4
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/kZf4m on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/kZf4m on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/kZf4m on line 7
Process exited with code 255.