note 18350 deleted from function.func-get-args by felipe

From: Date: Fri, 04 Jan 2008 01:38:42 +0000
Subject: note 18350 deleted from function.func-get-args by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134744@lists.php.net to get a copy of this message
Note Submitter: fbeyer at clickhand dot de dot noSpamPlease ---- Another way of passing references with a dynamic number of arguments: (This example is limited to 10 arguments) <?php define('NULL_ARG', 'DUMMY_ARGUMENT'); function refArg($arg0 = NULL_ARG, $arg1 = NULL_ARG, $arg2 = NULL_ARG, $arg3 = NULL_ARG, $arg4 = NULL_ARG, $arg5 = NULL_ARG, $arg6 = NULL_ARG, $arg7 = NULL_ARG, $arg8 = NULL_ARG, $arg9 = NULL_ARG) { for ($args=array(), $i=0; $i < 10; $i++) { $name = 'arg' . $i; if ($i < func_num_args()) { $args[$i] = &$$name; } unset($$name, $name); } $args[0] = 'Modified.'; } $test = 'Not modified.<br>'; refArg(&$test); echo $test; // Prints 'Modified' ?>

« previous php.notes (#134744) next »