Skip to content

Latest commit

 

History

History
executable file
·
41 lines (35 loc) · 602 Bytes

File metadata and controls

executable file
·
41 lines (35 loc) · 602 Bytes

Late Static Binding

http://php.net/manual/ru/language.oop5.late-static-bindings.php

Interesting example

<?php
class A {
    public static function foo() {
        static::who();
    }

    public static function who() {
        echo __CLASS__."\n";
    }
}

class B extends A {
    public static function test() {
        A::foo();
        parent::foo();
        self::foo();
    }

    public static function who() {
        echo __CLASS__."\n";
    }
}
class C extends B {
    public static function who() {
        echo __CLASS__."\n";
    }
}

/**
* A
* C
* C
 */
C::test();