class Foo
{
private $bar = ‘0’;public function bar()
{
return $this->bar;
}
}$foo = new Foo;
$attribute = new ReflectionProperty($foo, ‘bar’);
$attribute->setAccessible(true);
$attribute->setValue($foo, ‘1’);
var_dump($foo->bar());
class Foo
{
private $bar = ‘0’;public function bar()
{
return $this->bar;
}
}$foo = new Foo;
$attribute = new ReflectionProperty($foo, ‘bar’);
$attribute->setAccessible(true);
$attribute->setValue($foo, ‘1’);
var_dump($foo->bar());