3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Parent_Class { function __construct() { $x = $this->get_instance_schema(); } public function get_instance_schema() { return array( 'foo' => 1, ); } } class Child_Class extends Parent_Class { protected function get_instance_schema() { return array_merge( parent::get_instance_schema(), array( 'foo' => 1, ) ); } } $x = new Child_Class();
Output for 5.0.0 - 5.6.30, 7.0.0 - 7.1.3
Fatal error: Access level to Child_Class::get_instance_schema() must be public (as in class Parent_Class) in /in/j6emh on line 22
Process exited with code 255.
Output for hhvm-3.11.1 - 3.17.3
Fatal error: Uncaught Error: Access level to Child_Class::get_instance_schema() must be public (as in class Parent_Class) or weaker in /in/j6emh:16 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: Access level to Child_Class::get_instance_schema() must be public (as in class Parent_Class) or weaker in /in/j6emh on line 16
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/j6emh 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/j6emh 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/j6emh on line 9
Process exited with code 255.