3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php const FOO = BAR + 1; class Baz { const BAZ = BAR + 1; }; if (false) Baz::BAZ; // true にすると...? const BAR = 1; var_dump(FOO); // int(1) !! var_dump(Baz::BAZ); // int(2) !! var_dump(BAR); // int(1)
Output for 7.1.0
Notice: Use of undefined constant BAR - assumed 'BAR' in /in/Sqr2C on line 2 Warning: A non-numeric value encountered in /in/Sqr2C on line 2 int(1) int(2) int(1)
Output for 5.6.0 - 7.0.14
Notice: Use of undefined constant BAR - assumed 'BAR' in /in/Sqr2C on line 2 int(1) int(2) int(1)
Output for 5.3.0 - 5.5.38
Parse error: syntax error, unexpected '+', expecting ',' or ';' in /in/Sqr2C on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/Sqr2C on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONST in /in/Sqr2C on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Sqr2C on line 2
Process exited with code 255.