3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar = 'baz'; public function __construct() { unset($this->bar); } public function getFooBar() { return $this->bar; } } class Bar extends Foo { private $bar = 'baz'; public function __construct() { parent::__construct(); unset($this->bar); } public function getBarBar() { return $this->bar; } } $bar = new Bar(); var_dump($bar->getFooBar()); // notice + null var_dump($bar->getBarBar()); // notice + null $rBarBar = new ReflectionProperty(Foo::class, 'bar'); $rBarBar->setAccessible(true); $rBarBar->setValue($bar, __LINE__); var_dump($bar->getFooBar()); // line no. var_dump($bar->getBarBar()); // notice + null
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined property: Bar::$bar in /in/pCmTV on line 14 NULL Warning: Undefined property: Bar::$bar in /in/pCmTV on line 31 NULL int(42) Warning: Undefined property: Bar::$bar in /in/pCmTV on line 31 NULL

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:
69.1 ms | 401 KiB | 8 Q