Welcome to WebmasterWorld Guest from 54.163.115.193

Forum Moderators: coopster & jatar k

double $$ variables

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

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

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Seems like you have run into some variable variables [us2.php.net]. Although they can be extremely useful, they look pretty intense at first.
5:44 pm on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It could be a variable variable [php.net] (or a typo). :)
5:52 pm on Oct 11, 2007 (gmt 0)

5+ 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!

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month