3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<pre> <?php interface Greetable{ public function sayHello(); public function sayBye(); } interface Happyble{ public function sayHello(); } class Person implements Greetable, Happyble{ //CONCLUSIÓN: # 1. Las clases que implementen una interfaz implementar TODOS los métodos definidos en ellas! # 2. No pueden pasar de public a private de ninguna forma (herencia, interfaces) private $name = "Rowinson Gallego Medina"; public function sayHello(){ echo "Hello, $this->name!\n\n"; } public function sayBye(){} } $a = new Person(); $a->sayHello();
Output for 5.3.9 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre> Hello, Rowinson Gallego Medina!
Output for 5.0.0 - 5.3.8
<pre> Fatal error: Can't inherit abstract function Happyble::sayHello() (previously declared abstract in Greetable) in /in/tgBSq on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/tgBSq 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_STRING in /in/tgBSq on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/tgBSq on line 3
Process exited with code 255.