RE: [PHP] global generation
| From: | Tim Ward | Date: | Tue, 08 Jan 2002 08:55:19 +0000 |
| Subject: | RE: [PHP] global generation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79763@lists.php.net to get a copy of this message | ||
----------
From: Boget, Chris [SMTP:chris@wild.net]
Sent: 07 January 2002 19:20
To: 'Kevin Stone'; Rodney Davis; php-general@lists.php.net
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