- json_decode: documentation ( source)
- print_r: documentation ( source)
- json_encode: documentation ( source)
<?php
class myClass {
private $private_var;
public $public_var = 'Foobar';
public function setPrivate($value)
{
$this->private_var = $value;
}
public function __debugInfo()
{
return json_decode(json_encode($this), true);
}
}
$class = new myClass();
$class->setPrivate("Baz");
print_r($class);