3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public int $a; public string $b; public DateTime $c; } $foo = new Foo; $foo->a = "42"; // a will contain int(42) $foo->b = 42; // b will contain string("42") var_dump($foo); $foo->c = 12345; // will error
Output for git.master, git.master_jit, rfc.property-hooks
object(Foo)#1 (2) { ["a"]=> int(42) ["b"]=> string(2) "42" ["c"]=> uninitialized(DateTime) } Fatal error: Uncaught TypeError: Cannot assign int to property Foo::$c of type DateTime in /in/bmZ0H:14 Stack trace: #0 {main} thrown in /in/bmZ0H on line 14
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:
103.36 ms | 2174 KiB | 4 Q