What are the difference between self and $this in PHP?
self | $this |
---|---|
The “self” command can be used as a static function. | The $this command cannot be used as a static function. |
Self:: is used to access class variables and other methods | The $this-> is used to access class variables and methods within. |
It does not need an instantiated object. | It does need an instantiated object. |
BY Best Interview Question ON 21 Jul 2020