fork download
  1. <?php
  2.  
  3. class Foo
  4. {
  5. public $array = array('key' => "someFunc");
  6.  
  7. public function someFunc($foo, $bar)
  8. {
  9. return $foo . $bar;
  10. }
  11.  
  12. public function callFuncsFromArray()
  13. {
  14. foreach($this->array as $value) {
  15. $bar = call_user_func_array(["Foo", $value], ["FOO", "BAR"]);
  16. }
  17.  
  18. return $bar;
  19. }
  20. }
  21.  
  22. $foo = new Foo();
  23.  
  24. var_dump($foo->callFuncsFromArray());
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
string(6) "FOOBAR"