3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private DateTimeImmutable $bar; private ?string $foo; public function getBar(): DateTimeImmutable { return $this->bar ??= new DateTimeImmutable(); } public function getFoo(): ?string { return $this->foo ??= null; } public function setFoo(string $foo): self { $this->foo = $foo; return $this; } } $foo = new Foo(); var_dump($foo->getBar()); var_dump($foo->getBar()); var_dump($foo->getFoo()); $foo->setFoo('test'); var_dump($foo->getFoo());
Output for git.master
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003911" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003911" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL string(4) "test"
Output for git.master_jit
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003729" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003729" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL string(4) "test"
Output for rfc.property-hooks
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003562" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2019-12-03 09:39:38.003562" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL string(4) "test"

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