Call function with (unknown) variable number of parameters?
function, php, variadic
Solution
Assuming you want to create your own function like this, the key is to use `func_get_args()`:
function mumble(){
$args = func_get_args();
foreach ($args as $arg){
... whatever
}
}
If you just want to call it with multiple args, either "just do it", or use `call_user_func_array()`:
$args = array();
... append args to $args
call_user_func_array('array_intersect_key', $args);
Problem
I'm need to send params to the function ``` array_intersect_key() ``` but sometimes i'm need to send 2 arrays, sometimes - 3 or more: ``` array_intersect_key($arr_1, $arr_2); OR array_intersect_key($arr_1, $arr_2, $arr_3, $arr_4); ```