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"; } static function dosomething(){ echo "this is overwritten now". $this->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/4VZN3 on line 6 Deprecated: Creation of dynamic property StaticB::$email is deprecated in /in/4VZN3 on line 12 StaticB e@01art.de erno@01art.de

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:
50.84 ms | 401 KiB | 8 Q