3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Base { private $shadow; } #[AllowDynamicProperties] class Child extends Base {} $o = new Child(); $o->shadow = true; $o->noShadow = true; var_dump($o); echo "\n"; $r = new ReflectionObject($o); echo "hasProperty():\n"; var_dump($r->hasProperty('shadow')); var_dump($r->hasProperty('noShadow')); echo "\n"; echo "getProperty():\n"; try { var_dump($r->getProperty('shadow')); } catch (ReflectionException $e) { echo $e->getMessage(). "\n"; } echo "\n"; var_dump($r->getProperty('noShadow')); echo "\n"; echo "getProperties():\n"; var_dump($r->getProperties());
Output for rfc.property-hooks
object(Child)#1 (3) { ["shadow":"Base":private]=> NULL ["shadow"]=> bool(true) ["noShadow"]=> bool(true) } hasProperty(): bool(false) bool(true) getProperty(): Property Child::$shadow does not exist object(ReflectionProperty)#4 (2) { ["name"]=> string(8) "noShadow" ["class"]=> string(5) "Child" } getProperties(): array(2) { [0]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(6) "shadow" ["class"]=> string(5) "Child" } [1]=> object(ReflectionProperty)#5 (2) { ["name"]=> string(8) "noShadow" ["class"]=> string(5) "Child" } }
Output for git.master, git.master_jit
object(Child)#1 (3) { ["shadow":"Base":private]=> NULL ["shadow"]=> bool(true) ["noShadow"]=> bool(true) } hasProperty(): bool(true) bool(true) getProperty(): object(ReflectionProperty)#3 (2) { ["name"]=> string(6) "shadow" ["class"]=> string(5) "Child" } object(ReflectionProperty)#3 (2) { ["name"]=> string(8) "noShadow" ["class"]=> string(5) "Child" } getProperties(): array(2) { [0]=> object(ReflectionProperty)#3 (2) { ["name"]=> string(6) "shadow" ["class"]=> string(5) "Child" } [1]=> object(ReflectionProperty)#4 (2) { ["name"]=> string(8) "noShadow" ["class"]=> string(5) "Child" } }

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:
70.46 ms | 3030 KiB | 4 Q