Re: A variable inside a variable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux