9

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 :)

1
  • 2
    see func_get_args(); php.net/func_get_args . Also, you will need to use call_user_func_array instead of call_user_func Commented May 22, 2013 at 21:29

1 Answer 1

16

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));
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot. That's helped.
You can consider this issue as closed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.