3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Father { private $son; private $foo = ''; function getFoo() { return $this->foo; } } class Son { private $father; public function __construct(Father $dad) { $this->father = $dad; } function setFoo($value) { $this->dad->setFoo($value); } } $father = new Father(); $son = new Son($father); $son->setFoo('bar'); echo $father->getFoo(); //I want it to now be 'bar'
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined property: Son::$dad in /in/e4DcD on line 26 Fatal error: Uncaught Error: Call to a member function setFoo() on null in /in/e4DcD:26 Stack trace: #0 /in/e4DcD(33): Son->setFoo('bar') #1 {main} thrown in /in/e4DcD on line 26
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:
60.66 ms | 401 KiB | 8 Q