3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $bar; private $baz; public function setBar($value) { $foo = new static; $foo->baz = $this->baz; $foo->bar = $value; return $foo; } public function setBaz($value) { $foo = new static; $foo->bar = $this->bar; $foo->baz = $value; return $foo; } } $f = new Foo(); $g = $f->setBar('123'); $h = $f->setBaz('456'); var_dump($f, $g, $h);
Output for git.master, git.master_jit, rfc.property-hooks
object(foo)#1 (2) { ["bar":"foo":private]=> NULL ["baz":"foo":private]=> NULL } object(foo)#2 (2) { ["bar":"foo":private]=> string(3) "123" ["baz":"foo":private]=> NULL } object(foo)#3 (2) { ["bar":"foo":private]=> NULL ["baz":"foo":private]=> string(3) "456" }

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:
70.43 ms | 402 KiB | 8 Q