Re: $$var
| From: | Ashim Kapoor | Date: | Sun, 06 Mar 2011 15:04:33 +0000 |
| Subject: | Re: $$var | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311713@lists.php.net to get a copy of this message | ||
> Hi Ashim,
>
> These are called Variable Variables. Ideally they should be avoided,
> as they introduce unnecessary legibility issues.
>
> This is what it does in a nutshell, it's actually quite simple:
>
> $foo = 'bar';
> $bar = 'foobar';
> echo $$foo; //This prints foobar
>
> What it does is, take the value of $foo (which is 'bar') and if a
> variable exists by that name, it will go forth and print the value of
> $bar; In this case foobar.
>
Alright Russel, Thank you,
Ashim.