3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { } class Bar { public static $baz = 'baz'; protected static $bat = 'bat'; private static $qux = 'qux'; } $bar = new ReflectionClass(Bar::class); var_dump($bar->getStaticPropertyValue('baz')); var_dump($bar->getStaticPropertyValue('bat')); var_dump($bar->getStaticPropertyValue('qux'));
Output for 7.0.0 - 7.2.0
string(3) "baz" Fatal error: Uncaught ReflectionException: Class Bar does not have a property named bat in /in/PdAlu:16 Stack trace: #0 /in/PdAlu(16): ReflectionClass->getStaticPropertyValue('bat') #1 {main} thrown in /in/PdAlu on line 16
Process exited with code 255.
Output for 5.5.0 - 5.6.28
string(3) "baz" Fatal error: Uncaught exception 'ReflectionException' with message 'Class Bar does not have a property named bat' in /in/PdAlu:16 Stack trace: #0 /in/PdAlu(16): ReflectionClass->getStaticPropertyValue('bat') #1 {main} thrown in /in/PdAlu on line 16
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/PdAlu on line 14
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /in/PdAlu on line 14
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /in/PdAlu on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PdAlu on line 9
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_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/PdAlu on line 9
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/PdAlu on line 9
Process exited with code 255.