fork(1) download
  1. <?php
  2.  
  3. class cat {
  4. function say() {
  5. echo 'meow' . PHP_EOL;
  6. }
  7. }
  8.  
  9. class dog {
  10. function say() {
  11. echo 'woof' . PHP_EOL;
  12. }
  13. }
  14.  
  15. call_user_func([dog, 'say']);
  16. call_user_func(dog . '::say');
  17.  
  18. $cat = new cat();
  19. call_user_func([$cat, 'say']);
  20.  
Success #stdin #stdout #stderr 0.02s 24548KB
stdin
Standard input is empty
stdout
woof
woof
meow
stderr
PHP Warning:  Use of undefined constant dog - assumed 'dog' (this will throw an Error in a future version of PHP) in /home/dzJBTN/prog.php on line 15
PHP Warning:  Use of undefined constant dog - assumed 'dog' (this will throw an Error in a future version of PHP) in /home/dzJBTN/prog.php on line 16