3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Concrete5_Helper_Foo { public static function get() { return new self(); } } class Foo extends Concrete5_Helper_Foo { protected $firstName = 'Chris'; public function getFirstName() { return $firstName; } } var_dump(get_class(Concrete5_Helper_Foo::get())); var_dump(get_class(Foo::get())); var_dump(get_class(Foo::get()->getFirstName()));
Output for 7.0.0 - 7.1.0
string(20) "Concrete5_Helper_Foo" string(20) "Concrete5_Helper_Foo" Fatal error: Uncaught Error: Call to undefined method Concrete5_Helper_Foo::getFirstName() in /in/Ecncd:23 Stack trace: #0 {main} thrown in /in/Ecncd on line 23
Process exited with code 255.
Output for 5.2.3 - 5.6.28, hhvm-3.10.0 - 3.12.0
string(20) "Concrete5_Helper_Foo" string(20) "Concrete5_Helper_Foo" Fatal error: Call to undefined method Concrete5_Helper_Foo::getFirstName() in /in/Ecncd on line 23
Process exited with code 255.
Output for 5.0.0 - 5.2.2
string(20) "Concrete5_Helper_Foo" string(20) "Concrete5_Helper_Foo" <br /> <b>Fatal error</b>: Call to undefined method Concrete5_Helper_Foo::getFirstName() in <b>/in/Ecncd</b> on line <b>23</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/Ecncd</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/Ecncd</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/Ecncd</b> on line <b>4</b><br />
Process exited with code 255.