New Upload >>

Recent Uploads:

Untitled
about 11 hours ago
Calc
about 17 hours ago
Notepad API
about 17 hours ago
Calculadora
about 4 days ago
Untitled
about 4 days ago
Untitled
about 4 days ago
Untitled
about 4 days ago
Untitled
about 4 days ago
Calc
about 4 days ago
User and Roles ta..
about 5 days ago

Pastebin Archive


Bookmark and Share




Late Static Bindings' usage

Posted on February 6, 2010, 1:57 pm UTC anonymously (about 1 month ago)

Code (highlighted for PHP)
  1. <?php
  2. class A {
  3.     public static function who() {
  4.         echo __CLASS__;
  5.     }
  6.     public static function test() {
  7.         static::who(); // Here comes Late Static Bindings
  8.     }
  9. }
  10.  
  11. class B extends A {
  12.     public static function who() {
  13.         echo __CLASS__;
  14.     }
  15. }
  16.  
  17. B::test();
  18. ?>
  19.