3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Person { public static function status() { self::getStatus(); } protected static function getStatus() { echo "Person is alive"; } } //If we call Person::status() we will see "Person is alive" . Now consider what happens when we make a class that inherits from this: //class Deceased extends Person { protected static function getStatus() { echo "Person is deceased"; } } Deceased::getStatus()
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected 'protected' (T_PROTECTED) in /in/H2kb0 on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PROTECTED in /in/H2kb0 on line 21
Process exited with code 255.