3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $privateProperty = 1; private function privateMethod() {} } class B extends A {} try { echo (string) $method = new ReflectionMethod('B', 'privateMethod'); } catch(Throwable $e){ echo (string) $e; } try { echo (string) new ReflectionProperty('B', 'privateProperty'); } catch(Throwable $e){ echo (string) $e; }
Output for git.master, git.master_jit
Method [ <user, inherits A> private method privateMethod ] { @@ /in/Bso8B 6 - 6 } ReflectionException: Property B::$privateProperty does not exist in /in/Bso8B:16 Stack trace: #0 /in/Bso8B(16): ReflectionProperty->__construct('B', 'privateProperty') #1 {main}
Output for rfc.property-hooks
ReflectionException: Method B::privateMethod() does not exist in /in/Bso8B:11 Stack trace: #0 /in/Bso8B(11): ReflectionMethod->__construct('B', 'privateMethod') #1 {main}ReflectionException: Property B::$privateProperty does not exist in /in/Bso8B:16 Stack trace: #0 /in/Bso8B(16): ReflectionProperty->__construct('B', 'privateProperty') #1 {main}

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:
103.08 ms | 407 KiB | 5 Q