3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $staticProperty = 'foobar'; public $property = 'barfoo'; private $privateProperty = 'foofoo'; } $reflectionClass = new ReflectionClass('Foo'); $reflectionClass->getProperty('privateProperty')->setAccessible(true); var_dump($reflectionClass->getProperty('staticProperty')->getValue()); var_dump($reflectionClass->getProperty('property')->getValue(new Foo)); var_dump($reflectionClass->getProperty('privateProperty')->getValue());

preferences:
56.11 ms | 402 KiB | 5 Q