Forum Moderators: coopster

Message Too Old, No Replies

double $$ variables

         

sssweb

5:35 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Is there some special meaning if a variable is designated as $$variable (as opposed to $variable), or is this simply a typo in a script I found on the web.

dmorison

5:44 pm on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is valid PHP, and means "the variable of the name in the variable". So, if you went:

$foo = "bar";
$$foo = "Hello!";
print $bar;

You would see "Hello!" displayed.

eelixduppy

5:44 pm on Oct 11, 2007 (gmt 0)



Seems like you have run into some variable variables [us2.php.net]. Although they can be extremely useful, they look pretty intense at first.

whoisgregg

5:44 pm on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It could be a variable variable [php.net] (or a typo). :)

sssweb

5:52 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Thanks, guys

Re"
"It could be a variable variable (or a typo). :) "

Yes, but at least it's not DEFINITELY a typo...so there's hope!