I want to create a function similar to the MySqli extensions' mysqli_stmt_bind_param() function. I assume that this function takes its arguments passed by reference. Now, I know how to do variable length argument lists in a function with func_get_arg(s) but how do I tell it that they are to be passed by reference?
I'm using PHP5 and I want to stick by the latest recomendations..
There's a much simpler way to do this: just put in the & in the declaration.
<?php
error_reporting(E_ALL);
// Receives an array $args like you would get with func_get_args() function test(&$args) { $args[0] = 'blah'; $args[1] = 'I am different'; $args[2] = 'Do you see me in the original?'; }
$total = 10; // Set to any positive number of arguments for ($i=0; $i < $total; $i++) { $args[$i] = $i; }
test($args); // My bad, call_user_func_array passes a copy by default!? echo '<pre>'; print_r($args); echo '</pre>';
?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php