Home >Backend Development >PHP Tutorial >A detailed explanation of the differences between this, self, and parent in PHP_PHP Tutorial
{一}One of the differences between this, self, parent in PHP this article
Object-oriented programming (OOP, Object Oriented Programming) has now become a basic skill for programmers . Using OOP ideas for advanced programming of PHP is very meaningful for improving PHP programming capabilities and planning web development architecture.
After being rewritten, PHP5 has made a big leap in its support for OOP and has become a language with most of the features of an object-oriented language. It has many more object-oriented features than PHP4. Here I am mainly talking about the difference between the three keywords: this, self and parent. Literally understood, it refers to this, myself, and father respectively. Let me give a preliminary explanation first. This is a pointer to the current object (can be regarded as a pointer in C), self is a pointer to the current class, and parent is a pointer to the parent class. We frequently use pointers to describe here because there is no better language to express it. Regarding the concept of pointers, you can refer to the encyclopedia.
Let’s talk about it based on actual examples.