3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $oink = 'foo'; } $foo = new Foo; class Bar extends Foo { public function __construct() { var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); unset($this->oink); var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); $this->oink = 'bar'; var_dump( get_object_vars($this), get_class($this), get_parent_class($this), $r = new ReflectionProperty($this, 'oink'), $r->getValue($this), $p = new ReflectionProperty(get_parent_class($this), 'oink'), $p->getValue($this) ); } } $bar = new Bar;
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["oink"]=> string(3) "foo" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "foo" Warning: Undefined property: Bar::$oink in /in/LbFki on line 32 Warning: Undefined property: Bar::$oink in /in/LbFki on line 34 array(0) { } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL object(ReflectionProperty)#3 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } NULL array(1) { ["oink"]=> string(3) "bar" } string(3) "Bar" string(3) "Foo" object(ReflectionProperty)#4 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar" object(ReflectionProperty)#5 (2) { ["name"]=> string(4) "oink" ["class"]=> string(3) "Foo" } string(3) "bar"

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:
48.62 ms | 403 KiB | 8 Q