I have seen it once before, but I forgot the specific difference between static and self. I will review it this time.
static was added after PHP5.3, take a look at the English explanation:
self refers to the same class whose method the new operation takes place in.
static in PHP 5.3's late static bindings refers to whatever class in the hierarchy which you call the method on.
I have seen an article before that has a good example:class A { public static function who() { echo __CLASS__; } public static function test() { self::who(); // static::who(); } } A::test(); class B extends A { public static function who() { echo __CLASS__; } } echo B::test();
static: pointing to the class that calls it
It’s still easy to understand, don’t forget it next time.
The above introduces the difference between static and self in PHP, including static content. I hope it will be helpful to friends who are interested in PHP tutorials.