Wednesday, April 3, 2013

OOP -> Late Static Bindings

PHP5.3 Introduce a feature that's called late static bindings which is used to reference the called class in a context of static inheritance.

class ABC {
    public static function who() {
        echo __CLASS__;
    }
    public static function test() {
        self::who();
    }
}

class ABC1 extends ABC {
    public static function who() {
        echo __CLASS__;
    }
}

ABC1::test();

No comments:

Post a Comment