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();
foreach($this as $key => $val) {
$arr[$key] = $val;
}
return $arr;
}
This function also return private fields, and I don’t want that. How can I get only public variables here?
From the PHP documentation,