views:

101

answers:

1

I have a parameters array:

$params[1] = 'param1';
$params[2] = 'param2';
$params[3] = 'param3';
...
$params[N] = 'paramN';

I have a caller to various functions:

$method->$function( $params );

How can I parse the $params array, so multiple (and unlimited) parameters can be passed to any function:

$method->$function( $params[1], $params[2], ..., $params[N] );

The idea is to utilize the url rewrite like this:

http://domain.com/class/method/parameter/parameter/parameter/...

+3  A: 

You need to use call_user_func_array

call_user_func_array( array($method, $function), $params);
Yacoby