3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { // Public Constructor ... // No Problems Here. public function __construct( ) { } // Class Function. public function functionA( ) { } } class B extends A { // Public Constructor ... // Same As Parent Class ... // Again No Problems Here. public function __construct( ) { } // Class Function. public function functionB( ) { } } class C extends A { // Private Constructor ... // Weaker Then Parent Class ... // PHP Will Throw A Fatal Error. private function __construct( ) { } // Class Function. public function functionC( ) { } }
Output for 5.0.0 - 5.4.26
Fatal error: Access level to C::__construct() must be public (as in class A) in /in/Ff3QS on line 50
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/Ff3QS on line 7
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/Ff3QS on line 7
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/Ff3QS on line 7
Process exited with code 255.