Date: 11/30/07 (PHP Community) Keywords: no keywords Suppose you have a function called like this: $obj = new $class(); $obj->$function(); Now suppose you want to pass the function a number of parameters from 0 to n inclusive. Is it possible to pass the function an unknown number of parameters, provided that the parameters are stored in array, where array[0] is the first parameter, array[1] is the second, and so on? EDIT: Solved There's a function call_user_func_array that allows you to call a variable function with an array for parameters. Unfortunately, it doesn't work on $obj->$function .However, for some reason (couldn't find the explination), setting the object and function in an array as the first parameter works. call_user_func_array(array($obj, $function), $args);
|