RE: [PHP] Variable naming
| From: | Boget, Chris | Date: | Tue, 25 Sep 2001 18:26:06 +0000 |
| Subject: | RE: [PHP] Variable naming | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68751@lists.php.net to get a copy of this message | ||
> I want to use the value of a variable in a variable name. For
> instance:
>
> $id = 1;
> $sql_$id = "hey"; //set variable $sql_1 to hey
> print $sql_1; //should print hey
I *believe* (could be wrong) what you want is this:
print ${$sql_1};
Check out variable variables in the dox.
Chris