3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a; function __construct($a) { $this->a = $a; } public function getA() { return $this->a; } } class B extends A { function __construct() { parent::__construct('foo'); } } var_dump($b = new B); class C extends A { function __construct(A $a) { $a->a = 'bar'; $this->a = 'baz'; } } var_dump(new C($b)); var_dump($b->getA());
Output for git.master, git.master_jit, rfc.property-hooks
object(B)#1 (1) { ["a":"A":private]=> string(3) "foo" } Deprecated: Creation of dynamic property B::$a is deprecated in /in/5VPVV on line 25 Deprecated: Creation of dynamic property C::$a is deprecated in /in/5VPVV on line 26 object(C)#2 (2) { ["a":"A":private]=> NULL ["a"]=> string(3) "baz" } string(3) "foo"

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