Example Analysis of system functions and operators related to PHP Class and object
Xiaobian to share with you the PHP class and object-related system functions and operators of the example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!
The details are as follows:
System function
Class_exists () determines whether a class exists interface_exists () determines whether the interface exists get_class () / _ _ CLASS__ gets the class name of an object get_parent_class () gets the class name of the parent class to which the object belongs, gets all the methods of a class, and returns the index array get_class_vars () to get all the properties of a class The subscript is the attribute name get_declared_classes () gets all declared classes (including system classes) is_object () determines whether the object get_object_vars () gets all the attributes of the object, returns the array, and the subscript is the attribute name property_exists () to determine whether the attribute _ _ METHOD__ gets the method name _ _ FUNCTION__ to get the function name
Operator
New instantiates an object instanceOf to determine whether an object is an instance of a class (including inheritance) class bee {} $o = new bee (); if ($o instanceOf bee) {echo 'true';} is all the contents of the article "sample Analysis of PHP classes and object-related system functions and operators". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!