Re: A variable inside a variable?
| From: | Jochem Maas | Date: | Mon, 26 Jun 2006 20:10:50 +0000 |
| Subject: | Re: A variable inside a variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238665@lists.php.net to get a copy of this message | ||
Alex Major wrote:
> Thanks for your help with my other question, heres a new one for you.
>
> I need to nest a variable, inside another variable. For example:
>
> $($buildingname)level
>
> How (if at all) is this possible?
it's possible but probably an array is a better solution:
$someBuildinglevel = "foo";
$buildingname = "someBuilding";
echo ${$buildingname."level"}; // outputs "foo"
now go lookup variable variables in the manual to for your penance ;-)
>
> Thanks.
> Alex.
>