Monday, 17 April 2017

Difference between self and $this in php

$this
Use $this to refer to the current object. 

self::
Use self to refer to the current class. 


In other words, use  $this->member for non-static members, 
use self::$member for static members.

No comments:

Post a Comment