3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StaticA { public function setEmail($redirect) { $this-> email = $redirect; } static function dosomething(){ $obj = new static; $obj-> email = "e@01art.de"; $obj-> classInfo(); } function classInfo(){ echo get_class(new static). "\n"; echo $this->email. "\n"; } } class StaticB extends StaticA { function test(){ //echo get_class(new self). "\n"; parent::classInfo(); } function doit(){ parent::dosomething(); echo $this->email. "\n"; } function } $object = new StaticB(); $object->setEmail("erno@01art.de"); $object->doit();
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '}', expecting identifier (T_STRING) in /in/X5NhD on line 36
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '}', expecting T_STRING in /in/X5NhD on line 36
Process exited with code 255.

preferences:
188.73 ms | 1394 KiB | 64 Q