You cannot use $this inside a static function because static functions are independent of any instantiated object.
Try to make the function not static.
edit:
By definition, static methods can be called without any instantiated object, so using $this in a static method doesn't make any sense.
You cannot use
$this
inside a static function because static functions are independent of any instantiated object. Try to make the function not static.edit: By definition, static methods can be called without any instantiated object, so using
$this
in a static method doesn't make any sense.This is the right thing to do
For static methods , use
self::
instead of$this->
.See: PHP Static Method TutorialMore information:)