$this
inside static methodsclass 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