Re: dynamically change a variable name
| From: | Mark Maggelet | Date: | Mon, 19 Mar 2001 06:04:11 +0000 |
| Subject: | Re: dynamically change a variable name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44488@lists.php.net to get a copy of this message | ||
On Sun, 18 Mar 2001 20:36:15 -0500, Gary (kcooke@mediaone.net) wrote:
>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?
you could try:
for($i=1;$i<=3;$i++){
${"DWG".$i}=$DWG;
}
or it might make more sense to use an array.