Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

call_user_func with dynamic parameters

I am using php 5.3 (Windows 7).

I create a function that call another function with dynamic variables

func A call func B.
func2($a, $b, $c, ) ... the number of parameters can be dynamic.

call_user_func("func2", $x) - what is the correct syntax to use : call_user function with parameters, that the number of parameters is unknown.

Thanks :)

like image 565
Eitan Avatar asked May 22 '13 21:05

Eitan


1 Answers

I think what you are looking for is this http://www.php.net/call_user_func_array

    call_user_func_array('func2', array($a, $b, $c));
like image 147
tyd Avatar answered Sep 19 '22 00:09

tyd