I want to check if a local variable in a class is public or private. The reason is to create a function like this:
function ToArray() { $arr = array(); forea
From the PHP documentation,
$foo = new Foo(); $reflect = new ReflectionClass($foo); $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC); foreach ($props as $prop) { print $prop->getName() . "\n"; } var_dump($props);