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