RE: dynamically change a variable name
| From: | Tim Ward | Date: | Mon, 19 Mar 2001 11:31:46 +0000 |
| Subject: | RE: dynamically change a variable name | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44524@lists.php.net to get a copy of this message | ||
What do you mean? Do you want to change the variable to $dwg1 then $dwg2
then $dwg3 or what? A variable is a place for holding information. If you
want the same data under a different name then create a new variable equal
to the old variable then unset the original.
$dwg[0] = $dwg;
unset($dwg);
for ($i = 1; $i < $max; $i++)
{ $dwg[$i] = $dwg[$i - 1];
...
}
Tim Ward
Senior Systems Engineer
Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html
> -----Original Message-----
> From: Gary [mailto:kcooke@mediaone.net]
> Sent: 19 March 2001 01:36
> To: php-general@lists.php.net
> Subject: dynamically change a variable name
>
>
> Is there a way to dynamically change a variable name? For example:
> I want to change the variable name $DWG to
> $DWG1
> $DWG2
> $DWG3
> with a for loop. Is there a way to do this?
>
> Thanks, Gary
>
>
>