02
Sep
Learn PHP: self vs. $this
Q: In PHP 5, what is the difference between using self and $this?
A: Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
I recall that parent::member() is used to call a base class member function. Consequently, you could also use self::member() to call a non-static member function, though in most cases it would be better to use $this->member() so that polymorphism will work. As such, unless you specifically do not want a derived class member function override to work, use $this->member() for non-static member functions, reserving self::member() for static member functions.