Advertisement
michaelyuen

Untitled

Mar 28th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2. function myfunction () {
  3.     echo 'hello world<br>';
  4. }
  5.  
  6. call_user_func('myfunction');
  7.  
  8. function myfunction1 ($arg) {
  9.     echo 'hello world' . $arg . '<br>';
  10. }
  11.  
  12. call_user_func('myfunction1', '2018');
  13.  
  14. class Myclass {
  15.     public function testUserFunc() {
  16.         // you can call a function from outside your class
  17.         call_user_func('myfunction');
  18.     }
  19. }
  20.  
  21. $myclass = new Myclass;
  22. $myclass->testUserFunc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement