PHP provides several functions that you can use to get information about objects and classes.
1. You can check whether a class exists with the following:
2. You can test whether a property exists in a specific class with the following:
3. You can find out the properties, with their defaults, and the methods defined in a class with the following statements:
These functions return an array. The properties array contains the property name as the key and the default as the value. The methods array contains numeric keys and the names of the methods as values. If a property or method is private, the function will not return its name unless it is executed from inside the class.
4. You can test whether an object, its parents, or their implemented interfaces were created by a specified class using the instanceof operator, added in PHP 5, as follows:
if($objectname instanceof “classname”);
5. You can find out the current values of the properties of an object with the following function:
The function returns an array containing the current values of the properties, with the property names as keys.