3v4l.org

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

preferences:
25.84 ms | 404 KiB | 5 Q