+
Use $this to refer to the current **object**. Use self to refer to the current **class**.
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.
- "self" (not $self) refers to the type of class, where as $this refers to the current instance of the class. "self" is for use in static member functions to allow you to access static member variables. $this is used in non-static member functions, and is a reference to the instance of the class on which the member function was called.
- Because "this" is an object, you use it like: $this->member Because "self" is not an object, it's basically a type that automatically refers to the current class, you use it like: self::member
- http://stackoverflow.com/questions/151969/php-self-vs-this
PHP,self,this
✯
✯✯
✯✯
✯✯
✯✯
✯