Hi,
Monday, May 8, 2006, 4:20:11 AM, you wrote:
CJ> Hi,
CJ> Currently I have a function which accepts a limited number of parameters:
CJ> call_function($function_name, &$var_1, &$var_2);
CJ> I wish to modify the function to accept an indefinite number of
CJ> parameters, which may or may not be references.
CJ> The function call_function() then calls the function specified in
CJ> $function_name, with the variables passed as parameters to that function.
CJ> Is this possible? Thanks for any help which can be offered.
CJ> Chris
Here is a cutdown version of a class loader I use, It works for php4 and
php5 and with references. It should be easy to modify.
<?php
function &load_class($class_name,$arg1,$arg2,$arg3){
$num_args = func_num_args();
$arg_list = func_get_args();
$vars = '$return =& new '.$class_name.'(';
if($num_args > 1) {
for ($i = 1; $i < $num_args; $i++) {
$vars .= ($i > 1)? ',':'';
$varname = 'variable'.$i;
$$varname =& $arg_list[$i];
$vars .= "\$$varname";
}
}
$vars .= ');';
eval($vars);
return $return;
}
?>
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php