object

Tags:  •    •    •  

Sometimes you need all public properties of an object. I've also met this problem. I tried to find some usable native function on php.net, but the only native solution is the ReflectionProperty class. I think It claims too much resource. I've written an own function that has solved this issue.

Let's see the function

/**
 * It gets all public properties of given $object.
 * @param object $object It must be object.
 * @return array that contains all public property name as key and their values. example: