I recently got to know a new use of static
keyword.
I can also refer to the current class using
static
keyword.
So, say I have below class.
class X {
static $x = 'Hello World!';
public function greet(){
return static::$x; //Or self::$x
}
}
As, I can access $x
both ways using static::$x
and self::$x
.
So, Is there any difference betwen them? I can use them interchangeably or There is some cases they behave differently?