0
What is the difference between $this and self in PHP?
OOPs concept, PHP, $this, self
1 Answer
+ 8
Of course
$this points to the current instance of a class.
self keyword is used to access class constants, static variables and functions.
Examples:
$this->height;
$this->calculate();
self::DEFAULT_VALUE;
self::$staticVar;
self::staticMethod() ;