I want to create a function (my_function()
) getting unlimited number of arguments and passing it into another function (call_another_function()
). <
Use call_user_func_array
like
call_user_func_array('another_function', func_get_args());
It's not yet documented but you might use reflection API, especially invokeArgs.
(maybe I should have used a comment rather than a full post)
Try call_user_func_array:
function my_function() {
$args = func_get_args();
call_user_func_array("another_function", $args);
}
In programming and computer science, this is called an apply function.