1

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

thelolcat
  • 10,155
  • 19
  • 59
  • 100
  • Well, actually there's a difference - have a look here http://stackoverflow.com/questions/151969/php-self-vs-this#answer-6807615 – scibuff Feb 26 '12 at 21:59

3 Answers3

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