3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { const MY_CONST = false; public function my_const_self() { return self::MY_CONST; } public function my_const_static() { return static::MY_CONST; } } class B extends A { const MY_CONST = true; } $b = new B(); echo $b->my_const_self ? 'yes' : 'no'; // output: no echo $b->my_const_static ? 'yes' : 'no'; // output: yes ?>
based on 9ABXQ
Output for 5.3.0 - 7.3.1
Notice: Undefined property: B::$my_const_self in /in/AoF4F on line 17 no Notice: Undefined property: B::$my_const_static in /in/AoF4F on line 18 no
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/AoF4F on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC in /in/AoF4F on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/AoF4F on line 3
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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/AoF4F on line 3
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/AoF4F on line 3
Process exited with code 255.