What is the difference between self and static keyword in static method.
I do understand that you could not extend static methods, you could, but they would always reference to parent method.
And static keyword inside static method solves that.
So does it means I can forget about self, and joust use static from now on?
Or there are cases where I could use self?
Thanks.
I really cant explain it better or give better examples than the doc on Late Static Binding. So its not that you should always use one or another, its a question of whether you want/need to resolve the call up the inheritance chain (
static::theMethod()) or whether you want the traditional behavior (self::methodName()). I’m sure there are use cases for both.