3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private const C1 = "a"; private const C2 = 'b' } try { var_dump(constant('Foo::C1')); } catch(Error $e) { echo 'Caught',$e->getMessage(), PHP_EOL; } try{ Foo::C2; } catch(Error $e) { echo 'Caught',$e->getMessage() ,PHP_EOL; }
Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.10
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /in/cd420 on line 4
Process exited with code 255.

preferences:
173.22 ms | 1387 KiB | 44 Q