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(){ $this::dosomething(); echo $this->email. "\n"; } static function dosomething(){ echo "this is overwritten now". parent::email. "\n"; } } $object = new StaticB(); $object->setEmail("erno@01art.de"); $object->doit();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property StaticB::$email is deprecated in /in/ajTf3 on line 6 Fatal error: Uncaught Error: Undefined constant StaticA::email in /in/ajTf3:37 Stack trace: #0 /in/ajTf3(31): StaticB::dosomething() #1 /in/ajTf3(44): StaticB->doit() #2 {main} thrown in /in/ajTf3 on line 37
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.63 ms | 401 KiB | 8 Q