It is not possible to use
$this
inside static methods
class Greeting {
    public $nonStatic = 'some value';
    
    public static function hello() {
        return $this->nonStatic;
    }
}

// echo Greeting::hello();

$obj1 = new Greeting();
echo $obj1->hello();
After executing the above code, following error will be generated:
Fatal error:  Uncaught Error: Using $this when not in object context
by Valeri Tandilashvili
5 years ago
PHP
OOP
PHP Object Oriented Programming (OOP)
3
Pro tip: use ```triple backticks around text``` to write in code fences