Advertisement
hom3chuk

StackOverflow #11155553

Jun 22nd, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2.  
  3. class MyBaseClass {
  4.  
  5.     public static function __callStatic($what, $args)
  6.     {
  7.         return 'static call';
  8.     }
  9.  
  10.     public function __call($what, $args)
  11.     {
  12.         return 'dynamic call';
  13.     }
  14. }
  15.  
  16. class ProxyClass extends MyBaseClass {
  17.     //"Empty" class
  18. }
  19.  
  20. class MyDerivedClass extends MyBaseClass {
  21.  
  22.     function someAction()
  23.     {
  24.         return ProxyClass::Foo();
  25.     }
  26.  
  27. }
  28.  
  29. $bar = new MyDerivedClass();
  30. var_dump($bar->someAction()); //outputs 'static call'
  31.  
  32. /*
  33.  
  34. user@host ~ $ php test.php
  35. string(13) "static call"
  36.  
  37. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement