3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar = '1'; } $foo = new Foo(); for ($i = 1; $i < 101; $i++) { $r = new ReflectionProperty($foo, 'bar'); echo $r->getValue(); }
based on NV43p
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught ReflectionException: Cannot access non-public member Foo::bar in /in/EUaAv:12 Stack trace: #0 /in/EUaAv(12): ReflectionProperty->getValue() #1 {main} thrown in /in/EUaAv on line 12
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Uncaught exception 'ReflectionException' with message 'Cannot access non-public member Foo::bar' in /in/EUaAv:12 Stack trace: #0 /in/EUaAv(12): ReflectionProperty->getValue() #1 {main} thrown in /in/EUaAv on line 12
Process exited with code 255.