what's the point of declaring static functions in PHP?

Viewed 946

So in PHP you can have

Class A{
   function B(){}
}

and you can call this as if it were a static function:

A::B();

My question is...if I can do this, then why should I ever declare the function B() as static since doing so makes $this unavailable, so there's less flexibility, so you have everything to lose but nothing to gain...

or is there an advantage of declaring the function as static that I'm not aware of?

also I heard that "static calling of non static methods" are "deprecated"....what does that exactly mean especially in relation to this scenario? is calling A::B() when B() is not declared static something that I shouldn't be doing? if so, why is that the case?

4 Answers
Related