3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X { const A = 1, B = 2, C = A + B ; } echo X::C;
based on Kqu7Y
Output for 7.2.0
Warning: Use of undefined constant A - assumed 'A' (this will throw an Error in a future version of PHP) in /in/bTKXJ on line 11 Warning: Use of undefined constant B - assumed 'B' (this will throw an Error in a future version of PHP) in /in/bTKXJ on line 11 Warning: A non-numeric value encountered in /in/bTKXJ on line 11 Warning: A non-numeric value encountered in /in/bTKXJ on line 11 0
Output for 7.1.0 - 7.1.10
Notice: Use of undefined constant A - assumed 'A' in /in/bTKXJ on line 11 Notice: Use of undefined constant B - assumed 'B' in /in/bTKXJ on line 11 Warning: A non-numeric value encountered in /in/bTKXJ on line 11 Warning: A non-numeric value encountered in /in/bTKXJ on line 11 0
Output for 5.6.8 - 7.0.20
Notice: Use of undefined constant A - assumed 'A' in /in/bTKXJ on line 11 Notice: Use of undefined constant B - assumed 'B' in /in/bTKXJ on line 11 0
Output for 5.3.22 - 5.5.35
Parse error: syntax error, unexpected '+', expecting ',' or ';' in /in/bTKXJ on line 7
Process exited with code 255.