fork(3) download
  1. <?php
  2.  
  3. function funcRef($func){
  4. return create_function('', "return call_user_func_array('{$func}', func_get_args());");
  5. }
  6.  
  7. function foo($a, $b, $c){
  8. return sprintf("A:%s B:%s C:%s", $a, $b, $c);
  9. }
  10.  
  11. $b = funcRef("foo");
  12.  
  13. echo $b("hello", "world", 123);
  14.  
  15. //=> A:hello B:world C:123
Success #stdin #stdout 0.01s 24448KB
stdin
Standard input is empty
stdout
A:hello B:world C:123