This article mainly introduces the PHP class and object-related system functions and operators, combined with examples to summarize and analyze the PHP class and object operation process commonly used in system functions and operators, the need for friends can refer to the following
This article summarizes the PHP class and object-related system functions and operators. Share to everyone for your reference, as follows:
System functions
Class_exists () |
Determine if a class exists |
Interface_exists () |
Determine if an interface exists |
Get_class ()/class |
Gets the class name where an object is located |
Get_parent_class () |
Gets the class name of the parent class to which an object belongs |
Get_class_methods () |
Get all methods of a class, return an indexed array |
Get_class_vars () |
Get all properties of a class, subscript as property name |
Get_declared_classes () |
Get all declared classes (including system classes) |
Is_object () |
Determine if the object |
Get_object_vars () |
Get all properties of the object, return an array, subscript the property name |
Property_exists () |
Determine if the property exists in the object |
METHOD |
Get Method Name |
FUNCTION |
Get the name of a function |
Operator
New |
Instantiate an Object |
instanceof |
Determines whether an object is an instance of a class (including inheritance) |
Class bee{} $o = new Bee (), if ($o instanceof Bee) {echo ' true ';}