Home » Php » php – call_user_func with dynamic parameters

php – call_user_func with dynamic parameters

Posted by: admin July 12, 2020 Leave a comment


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 🙂

How to&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));