- var_dump: documentation ( source)
<?php
class Foo {
private $foo;
protected $bar;
public $baz;
}
$map = [];
foreach ([new ReflectionProperty('Foo', 'foo'), new ReflectionProperty('Foo', 'bar'), new ReflectionProperty('Foo', 'baz')] as $property) {
$class = & $map[$property->getDeclaringClass()->getName()];
$class[$property->getName()] = ($property->isPublic() && \ReflectionProperty::IS_PUBLIC)
| ($property->isProtected() && \ReflectionProperty::IS_PROTECTED)
| ($property->isPrivate() && \ReflectionProperty::IS_PRIVATE);
}
var_dump($map);