This question already has an answer here:
How to secure private class field with PHP OO? I don't want to make private class field $a public, but when I do something like that:
class Hidden {
private $a = 'Very important, hidden variable';
protected $b = 'secret';
}
$obj = new Hidden();
$c = (array)$obj;
print_r($c);
$a is available for everybody:
Array ( [Hiddena] => Very important, hidden variable [*b] => secret )
</div>