When you use static :: NAME, this is a function called late static binding (or LSB). For more information about this function, see the php.net LSB documentation page: http://nl2.php.net/manual/en/language.oop5.late-static-bindings.php
An example is the following example:
<?php class A { public static function who() { echo __CLASS__; } public static function test() { self::who(); } } class B extends A { public static function who() { echo __CLASS__; } } B::test(); ?>
This infers A, which is not always desirable. Now replacing self with static creates the following:
<?php class A { public static function who() { echo __CLASS__; } public static function test() { static::who();
And, as you would expect, it displays "B"
Jurian sluiman
source share