Advertisement
sri211500

Untitled

Feb 25th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. class MethodTest
  3. {
  4.  
  5. public function __call($name, $argument)
  6. {
  7. // Note: value of $name is case sensitive.
  8. echo "Calling object method '$name'"
  9. .implode(',', $argument)."\n";
  10. }
  11.  
  12. /** As of PHP 5.3.0 */
  13. public static function __callStatic($name, $argument)
  14. {
  15.  
  16. // Note: value of $name is case sensitive.
  17. echo "Calling static method '$name'"
  18. .implode(",", $argument)."\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
Advertisement