passing by reference via the variable arg list

From: Date: Mon, 23 Sep 2002 17:23:08 +0000
Subject: passing by reference via the variable arg list
Groups: php.general 
Request: Send a blank email to php-general+get-117304@lists.php.net to get a copy of this message
Can anyone help with this? I am relativly new to PHP and am trying to use variable numbers of parameters to functions using the func_get_arg(). However, I am unable to determine the correct syntax for passing by reference via the variable arg list. Trevor /* This Works Fine */ function Foo($Index, &$TxtString) { $TxtString = "NewString"; } /* However: how do you pass by reference using a variable number of parameters */ function Foo() { if(func_get_arg(0) == 3) { /* Can you have a variable in function foo that allows access by reference? */ $TxtString = func_get_arg(1); $TxtString = "Second New String"; } } function FooTest() { $StringTest = 'Test'; Foo(2); Foo(3, $StringTest); echo ("$StringText"); }

« previous php.general (#117304) next »