3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StaticA { public function setEmail($redirect) { $this->email = $redirect; } function dosomething(){ $obj = new static; $obj->email = $this->email; $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"; } function dosomething(){ echo "YOU SUCK AT PHOTOSHOP!"; echo parent::email; } } $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/g03BE on line 6 YOU SUCK AT PHOTOSHOP! Fatal error: Uncaught Error: Undefined constant StaticA::email in /in/g03BE:36 Stack trace: #0 /in/g03BE(30): StaticB->dosomething() #1 /in/g03BE(43): StaticB->doit() #2 {main} thrown in /in/g03BE on line 36
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:
41.91 ms | 401 KiB | 8 Q