Re: [PHP] passing by reference via the variable arg list

2002-09-24 Thread Marek Kilimajer

Not possible, but workaround is to pass the variable name and use it as 
a variable variable, but for this the variable needs to be global.

Trevor Dowling wrote:

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);
}



  



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] passing by reference via the variable arg list

2002-09-24 Thread Trevor Dowling

Thought as much after some head scratching,

Thanks


Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Not possible, but workaround is to pass the variable name and use it as
 a variable variable, but for this the variable needs to be global.

 Trevor Dowling wrote:

 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);
 }
 
 
 
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php