Advertisement
sebbu

test function call

Feb 25th, 2018
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2.  
  3. Class TestFonction
  4. {
  5.     public function function01(string $arg1)
  6.     {
  7.         echo 'Hello '.$arg1.'!'."\r\n";
  8.     }
  9.    
  10.     public function function02(string $arg1)
  11.     {
  12.         echo 'Bye '.$arg1.'!'."\r\n";
  13.     }
  14. };
  15.  
  16. $ar=array('function01','function02');
  17.  
  18. $tf=new TestFonction();
  19.  
  20. foreach($ar as $fct)
  21. {
  22.     $tf->{$fct}('sebbu');
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement