$this keyword is used to refer to the current object. It is only available inside the method of the class. Basically, it refers to the object of the current method.
The general syntax for accessing class property and method.
Note:Please keep in mind that, Only the
$this keyword starts with the
$. sign. Do not specify the
$ sign before the property and method name.
Followings are the invalid syntax.