3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'bar'; public $baz = 'baz'; } class FooHack extends Foo { public function __construct(Foo $wrapped) { unset($this->bar); } } $foo = new FooHack(new Foo); $reflectionFooBar = new \ReflectionProperty(Foo::class, 'bar'); var_dump((new ReflectionClass(Foo::class))->getProperties()); var_dump($reflectionFooBar->getValue($foo)); var_dump( property_exists(FooHack::class, 'bar'), property_exists($foo, 'bar') );
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "Foo" } [1]=> object(ReflectionProperty)#5 (2) { ["name"]=> string(3) "baz" ["class"]=> string(3) "Foo" } } Warning: Undefined property: FooHack::$bar in /in/VDMHm on line 21 NULL bool(true) bool(true)

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