Late static binding in PHP - What, How & When

1 · Amit Merchant · Aug. 7, 2019, 1:18 p.m.
The inheritence tree in PHP quickly gets dirty if you’re using mix of static and non-static methods into your classes and the inheritence gets deeply nested. Take from example here. <?php class Alpha { public static function getClassname() { echo __CLASS__; } public static function printClass() { self::getClassname(); } } class Beta extends Alpha { public static function getClassname() { echo __CLASS__; } } Beta::printClass(); ...