Tag: difference between $this and self

Difference between $this and self?

Inside a class definition, $this refers to the current object, while self refers to the current class. It is necessary to refer to a class element using self, and refer to an object element using $this. self::STAT // refer to a constant like this self::$stat // static variable $this->stat // refer to an object variable …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/04/difference-between-this-and-self/