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

怪我咯
Release: 2023-03-11 20:32:01
Original
1027 people have browsed it

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';
}
Copy after login
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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template