113
Some Helpful Functions in PHP to get the Information About Class and Object
1. get_class: By using this, we can get the class name of an object.
Example 1
Output:
2. get_class_vars: It is used to get all variables of a class as Array elements.
Example 2
Output:
3. get_class_methods: To get the all methods of a class as an array.
Example 3
Output:
4. get_declare_classes: To get the all declare classes in current script along with predefined classes.
Example 4
Output:
5. get_object_vars: To get all variables of an object as an array.
Example 5
Output:
6. class_exists: To check whether the specified class is existed or not.
Example 6
Output:
7. is_subclass_of: By using this function we can check whether the 1st class is subclass of 2nd class or not.
Example 7
Output:
8. method_exists: By using this function we can check whether the class method is existed or not.
Example 8
Output:
Next TopicPHP OOPs Inheritance