Hi, Friday, April 30, 2004, 1:40:26 AM, you wrote: AC> I want to create a function similar to the MySqli extensions' AC> mysqli_stmt_bind_param() function. I assume that this function takes AC> its arguments passed by reference. Now, I know how to do variable AC> length argument lists in a function with func_get_arg(s) but how do I AC> tell it that they are to be passed by reference?
Just make them all references, if it was expecting a copy it will just get a reference to a copy, if it was expecting a reference it will get one. I do a similar trick in a class loader I use that copes with variable length argument lists and passing by reference. A bit like this $num_args = func_num_args(); $arg_list = func_get_args(); $vars = 'function_to_call('; for ($i = 0; $i < $num_args; $i++) { $vars .= ($i > 0)? ',':''; $varname = 'variable'.$i; $$varname =& $arg_list[$i]; $vars .= "\$$varname"; } $vars .= ');'; //that leaves you with a string you can use eval on eval($vars); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php