With the new static keyword in PHP 5, is there any reason to use self keyword? I don't see any use-cases for it anymore
Asked
Active
Viewed 112 times
3 Answers
3
self and static mean two different things. See the documentation on late static binding. The first two examples demonstrate the difference.
Michael Mior
- 27,152
- 8
- 85
- 111
2
In the context of static method if you wish to call another static method - you use self::anotherStaticMethod()
zerkms
- 240,587
- 65
- 429
- 525
0
It is for static class members (access staic things in the same class) - that do not have a $this.
Ed Heal
- 57,599
- 16
- 82
- 120