3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private const BAR = 42; } $r = new ReflectionClass(Foo::class); var_dump( $r->getReflectionConstants(), $r->getReflectionConstant('BAR')->isPrivate() );
Output for 7.1.0 - 7.2.6
array(1) { [0]=> object(ReflectionClassConstant)#2 (2) { ["name"]=> string(3) "BAR" ["class"]=> string(3) "Foo" } } bool(true)
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /in/pgvAo on line 5
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected T_CONST, expecting T_VARIABLE in /in/pgvAo:5 Stack trace: #0 {main}
Process exited with code 255.