Click to See Complete Forum and Search --> : Variable Functions argument problem


Anon
02-15-2001, 03:10 AM
Hi,

How can I make this work:

function func($arg1,$arg2) {
...
}

$function_to_call = \'func\';
$variable_list = \'arg_one, arg_two\';

$function_to_call ($variable_list);

Of course, PHP interprets $variable_list as one string and consequently as the one and only parameter for the function to call.
However I need \'arg_one\' to be accepted as the first, and arg_two as my second parameter.

I don not want to (how do you say) \'deliver\'(?) only one argument like $variable_list, which I could break inside the function...this is ugly and wouldn\'t work for arguements containing \',\'!

Thanks for your help!!

Tom

vincente
02-15-2001, 05:46 AM
You could use eval() I guess, but I can't think when you'd ever want to use this construction....

eval("$func ($vars)");