I have a variable length array that I need to transpose into a list of parameters for a function.
I hope there is a neat way of doing this - but I cannot see how.
The code that I am writing will be calling a method in a class - but I will not know the name of the method, nor how many parameters it has.
I tried this - but it doesn't work:
$params = array(1 => "test", 2 => "test2", 3 => "test3");
ClassName::$func_name(implode($params, ","));
The above lumps all of the values into the first parameter of the function. Whereas it should be calling the function with 3 parameter values (test, test2, test3).
What I need is this:
ClassName::$func_name("test", "test2", "test3");
Any ideas how to do this neatly?