Welcome to WebmasterWorld Guest from 54.162.166.214

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

double $$ variables

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

Preferred Member

10+ Year Member

joined:Nov 10, 2005
posts: 387
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 3, 2003
posts:1633
votes: 0


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)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 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.
5:44 pm on Oct 11, 2007 (gmt 0)

Senior Member from US 

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

joined:Dec 9, 2003
posts:3416
votes: 0


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

Preferred Member

10+ Year Member

joined:Nov 10, 2005
posts:387
votes: 0


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!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members