3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php abstract class Base { private $foo; public void setFoo($foo) { $this->foo = $foo; } public function foo() { return $this->foo; } } class Foo extends Base { public function foo() { return ' - '.parent::foo(); } } $obj = new Foo(); $obj->setFoo('yay'); var_dump($obj->foo());
Output for 5.4.0 - 5.4.29
Parse error: syntax error, unexpected 'void' (T_STRING), expecting variable (T_VARIABLE) in /in/3W5VN on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/3W5VN on line 5
Process exited with code 255.