- print_r: documentation ( source)
<?php
class Foo {
private $test = 'sd';
private $test2 = [
'test' => true,
'foo' => ['test'=>'asdasdads'
]
];
}
function dismount($object) {
$reflectionClass = new ReflectionClass(get_class($object));
$array = array();
foreach ($reflectionClass->getProperties() as $property) {
$property->setAccessible(true);
$array[$property->getName()] = $property->getValue($object);
$property->setAccessible(false);
}
return $array;
}
$foo = new Foo;
print_r( dismount($foo));