Home  >  Article  >  Backend Development  >  Summary of system functions and operators related to PHP classes and objects

Summary of system functions and operators related to PHP classes and objects

怪我咯
怪我咯Original
2017-06-28 13:40:141016browse

This article mainly introduces the system functions and operators related to PHP classes and objects, and summarizes and analyzes the commonly used system functions and operators in the operation process of phpclasses and objects in combination with examples. Operators, friends in need can refer to

This article summarizes PHP class and object-related system functions and operators. Share it with everyone for your reference, as follows:

System function

##class_exists()Judge a certain Whether a class existsinterface_exists()Determine whether the interface existsget_class() / CLASSGet the class name of an object##get_parent_class()get_class_methods()index##get_class_vars()get All attributes of a class, the subscript is the attribute nameget_declared_classes()is_object()get_object_vars()Get all the properties of the object and return an array, the subscript is the property nameproperty_exists()Judge whether the property exists in the objectMETHODGet the method nameFUNCTIONGet the function nameOperator
Get the class name of the parent class to which an object belongs
Get all methods of a class, return array
Get all declared classes (including system classes)
Judge whether it is an object

newInstantiate an objectinstanceOfJudge whether an object is an instance of a certain class (including )
class bee{}
$o = new bee();
if($o instanceOf bee){
 echo 'true';
}
inheritance

The above is the detailed content of Summary of system functions and operators related to PHP classes and objects. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn