3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private static DateTimeImmutable $bar; private static ?string $foo; public static function getBar(): DateTimeImmutable { return self::$bar ??= new DateTimeImmutable(); } public static function getFoo(): ?string { return self::$foo ??= null; } public static function setFoo(string $foo): void { self::$foo = $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)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003768" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003768" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL string(4) "test"
Output for git.master_jit
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003835" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003835" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } NULL string(4) "test"
Output for rfc.property-hooks
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003578" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2019-12-02 18:26:16.003578" ["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:
56.74 ms | 401 KiB | 8 Q