I'm currently looking for a way to give arguments to a function dynamically. Some code to explain:
//Class: ClassXY
PUBLIC function function1($arg1, $arg2, $arg3);
PUBLIC function function2($arg1);
I currently call it like this:
// $method = 'function1' or 'function2'
echo ClassXY :: {$method}($parameter_string);
My problem is, that parameter_string either is a simple string, that contains the argument or an array that contains all the arguments I want to give to the function. For instance:
$parameter_string: array(3) {[0] => 'arg1', [1] => 'arg2', [2] => 'arg3' }
So far so good. My Problem is, that the call will only work with ClassXY :: function2() since it only expects one argument. If I call ClassXY :: function2() it wont work, since it expects three arguments but only one argument (the array with the three elements, that are supposed to be the three arguments) is given. I need a way to make php realize that each element of the array shall be one argument. Any Ideas?
Thanks in advance!