3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public int $a; protected int $b; private int $c; public function __construct() { $this->a = 2; $this->b = 3; $this->c = 4; } } $foo = new Foo(); $arr = (array) $foo; $o = (object) $arr; // should emit a warning as protected properties are renamed print_r($foo); print_r($arr); print_r($o); $o->b = 10; // because this creates new property! print_r($o);
Output for git.master_jit, git.master, rfc.property-hooks
Foo Object ( [a] => 2 [b:protected] => 3 [c:Foo:private] => 4 ) Array ( [a] => 2 [*b] => 3 [Fooc] => 4 ) stdClass Object ( [a] => 2 [b:protected] => 3 [c:Foo:private] => 4 ) stdClass Object ( [a] => 2 [b:protected] => 3 [c:Foo:private] => 4 [b] => 10 )

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:
66.5 ms | 406 KiB | 5 Q