Last active
December 21, 2015 18:39
-
-
Save johnpbloch/6349286 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
private $bar; | |
public function __construct($bar){ | |
$this->bar = $bar; | |
} | |
} | |
$thing = new Foo('baz'); | |
$prop = new ReflectionProperty('Foo', 'bar'); | |
$prop->setAccessible(true); | |
echo $prop->getValue($thing); // Will print 'baz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment