(N is unknown)
$controller->$action($params);
must be
$controller->$action($param1, $param2, $param3... $paramN);
(N is unknown)
$controller->$action($params);
must be
$controller->$action($param1, $param2, $param3... $paramN);
Not really sure what you want, but if you want to call a method with an unknown number of parameters you can use call_user_func_array()
for example:
$result = call_user_func_array(array($controller, $action), $params);
which given an array like:
array(1, 2, 'a');
would be equivalent to this:
$result = $controller->$action(1, 2, 'a');
You could build such an array by doing something like below, but I think it would be better to use an array in the first place
$param1 = 'Something';
$param2 = 'Test';
$j = 1;
$params = array();
while (isset(${'param' . $j})) {
$params[] = ${'param' . $j};
$j++;
}
print_r($params);
//will output
Array
(
[0] => Something
[1] => Test
)