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'; } } new C($b); var_dump($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/sbLSK on line 25 object(B)#1 (2) { ["a":"A":private]=> string(3) "foo" ["a"]=> string(3) "bar" } 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:
61.33 ms | 401 KiB | 8 Q