run code in 300+ PHP versions simultaneously
<?php class A { private $var; } class B extends A { } $ro = new ReflectionObject(new A()); echo $ro->hasProperty('var') ? 'true' : 'false', "\n"; // returns true echo $ro->getProperty('var'), "\n"; // prints property $ro = new ReflectionObject(new B()); echo $ro->hasProperty('var') ? 'true' : 'false', "\n"; // returns true echo $ro->getProperty('var'), "\n"; // throws exception
Output for git.master, git.master_jit
true Property [ private $var = NULL ] false Fatal error: Uncaught ReflectionException: Property B::$var does not exist in /in/PRA1f:16 Stack trace: #0 /in/PRA1f(16): ReflectionClass->getProperty('var') #1 {main} thrown in /in/PRA1f on line 16
Process exited with code 255.

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

47.75 ms | 459 KiB | 5 Q