3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class StaticA { public function setEmail($redirect) { $this->email = $redirect; } protected function returnthis(){ return $this; } private function dosomething(){ echo "Unrspr├╝ngliche Methode"; $obj = parent::returnthis(); echo $obj->email; } public function classInfo(){ echo get_class(new static). "\n"; echo $this->email. "\n"; } } class StaticB extends StaticA { public function test(){ //echo get_class(new self). "\n"; parent::classInfo(); } public function doit(){ $this->dosomething(); //echo $this->email. "\n"; } private function dosomething(){ $obj = parent::returnthis(); echo "Neue Methode!". "\n"; echo "Hier ist die E-Mail aus der Elternklasse: "$obj->email; } } $object = new StaticB(); $object->setEmail("erno@01art.de"); $object->doit();
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '$obj' (T_VARIABLE), expecting ',' or ';' in /in/YifWr on line 41
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /in/YifWr on line 41
Process exited with code 255.