Rofihimam

Untitled

Feb 19th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2.     /**
  3.      *
  4.      */
  5.     class MethodTest
  6.     {
  7.        
  8.         function __call($name, $arguments)
  9.         {
  10.             // Note : Value of $name is case sensitive
  11.             echo "Calling object method '$name'".implode(',', $arguments)."\n";
  12.         }
  13.  
  14.         // As of PHP 5.3.0
  15.         public static function __callStatic($name, $arguments)
  16.         {
  17.             // Note : Value of $name is case sensitive
  18.             echo "Calling static method '$name'".implode(',', $arguments)."\n";
  19.         }
  20.     }
  21.  
  22.     $obj = new MethodTest;
  23.     $obj->runTest('In object context');
  24.  
  25.     MethodTest::runTest('In static context'); // As of PHP 5.3.0
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment