3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $private = 'private'; public $public = 'public'; } class B { //public $private = 'pr'; private $public = 'pu'; } $r = new \ReflectionClass('A'); $p = $r->getProperty('private'); $p->setAccessible(true); $p->setAccessible(false); var_dump($p->getValue(new stdClass())); $p = $r->getProperty('public'); $p->setAccessible(false); var_dump($p->getValue(new A()));