RE: [PHP] global generation

2002-01-08 Thread Tim Ward



--
From:  Boget, Chris [SMTP:[EMAIL PROTECTED]]
Sent:  07 January 2002 19:20
To:  'Kevin Stone'; Rodney Davis; [EMAIL PROTECTED]
Subject:  RE: [PHP] global generation

 Wait until after the for loop has completed.
 for ($i=0; $i $num_results; $i++) {
 $variable[$i];
 }
 global $variable;

That's not going to work.  The only thing that is doing is
making an already global instance of $variable global 
within the function.
What you want is this instead:

$GLOBALS[$variable] = $variable;
$GLOBALS[variable] = $ variable, typo I assume

Tim, www.chessish.com

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] global generation

2002-01-07 Thread Rodney Davis

I need to call a generated variable global w/i a function but the
following doesn't work:

for ($i=0; $i  $num_results; $i++)
{
global $variable[$i];
}

I am trying to pass a similarly created form element to a function.  I
have two questions.  Why doesn't this work? And, what else can I do to
get the same results.

Thanks,

rodney



Re: [PHP] global generation

2002-01-07 Thread Andrey Hristov

try :
for ($i=0; $i  $num_results; $i++)
{ 
$some= $$GLOBALS[variable];
  // $some[$i] is what you need.
}

Regards,

Andrey Hristov
- Original Message - 
From: Rodney Davis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 07, 2002 6:11 PM
Subject: [PHP] global generation


 I need to call a generated variable global w/i a function but the
 following doesn't work:
 
 for ($i=0; $i  $num_results; $i++)
 {
 global $variable[$i];
 }
 
 I am trying to pass a similarly created form element to a function.  I
 have two questions.  Why doesn't this work? And, what else can I do to
 get the same results.
 
 Thanks,
 
 rodney
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] global generation

2002-01-07 Thread Andrey Hristov

Ooops, no $$ before GLOBALS, single $
for ($i=0; $i  $num_results; $i++)
{ 
 $some= $GLOBALS[variable];
   // $some[$i] is what you need.
 }

Regards,
Andrey Hristov
- Original Message - 
From: Andrey Hristov [EMAIL PROTECTED]
To: Rodney Davis [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, January 07, 2002 6:15 PM
Subject: Re: [PHP] global generation


 try :
 for ($i=0; $i  $num_results; $i++)
 { 
 $some= $$GLOBALS[variable];
   // $some[$i] is what you need.
 }
 
 Regards,
 
 Andrey Hristov
 - Original Message - 
 From: Rodney Davis [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, January 07, 2002 6:11 PM
 Subject: [PHP] global generation
 
 
  I need to call a generated variable global w/i a function but the
  following doesn't work:
  
  for ($i=0; $i  $num_results; $i++)
  {
  global $variable[$i];
  }
  
  I am trying to pass a similarly created form element to a function.  I
  have two questions.  Why doesn't this work? And, what else can I do to
  get the same results.
  
  Thanks,
  
  rodney
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] global generation

2002-01-07 Thread Kevin Stone

Wait until after the for loop has completed.

for ($i=0; $i $num_results; $i++)
{
$variable[$i];
}
global $variable;

 I need to call a generated variable global w/i a function but the
 following doesn't work:
 
 for ($i=0; $i  $num_results; $i++)
 {
 global $variable[$i];
 }
 
 I am trying to pass a similarly created form element to a function.  I
 have two questions.  Why doesn't this work? And, what else can I do to
 get the same results.
 
 Thanks,
 
 rodney
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] global generation

2002-01-07 Thread Boget, Chris

 Wait until after the for loop has completed.
 for ($i=0; $i $num_results; $i++) {
 $variable[$i];
 }
 global $variable;

That's not going to work.  The only thing that is doing is
making an already global instance of $variable global 
within the function.
What you want is this instead:

$GLOBALS[$variable] = $variable;

Chris