php this、self、parent差异

WBOY
Release: 2016-06-13 11:57:31
Original
941 people have browsed it

php this、self、parent区别

1、this是指向当前对象的指针如:同class里面的其他函数可以用 this->函数名 调用。2、self是指向当前类的指针一般self使用来指向类中的静态变量,还要注意使用self来调用静态变量必须使用:: (域运算符号)如:self::$firstCount;      //使用self来调用静态变量3、parent是指向父类的指针一般我们使用parent来调用父类的构造函数如:parent::__construct( "PBPHome");    //使用parent调用了父类的构造函数
Copy after login

?

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!