webguync Posted March 26, 2008 Share Posted March 26, 2008 sorry if this is a stupid question, but what does a double dollar sign indicate in php? eg: $$MyPrice Quote Link to comment Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 Variable variables. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Share Posted March 26, 2008 check this out: http://forums.digitalpoint.com/showthread.php?t=9338 Quote Link to comment Share on other sites More sharing options...
eddierosenthal Posted March 26, 2008 Share Posted March 26, 2008 <? $myprice = 10.00; $item = $myprice; $$myprice = 20.00; echo "the value of \$\$myprice is" . $$myprice; ?> output is 'the value of $$myprice is20' $numberofnames = 10; if you have fields with names like name1, name2, name3 etc. you could for ( $i = 1; $i <= $numberofnames; $i++) { $t = "name$i"; echo $$t . "<br>" ; } or <? $numberofnames = 10; $name1 = "my string here"; #if you have fields with names like name1, name2, name3 etc. you could for ( $i = 1; $i <= $numberofnames; $i++) { $t = "name$i"; echo $$t ; } ?> yields output 'my string here' so there is some relevance to using it if you have to iterate thru values that have similar names or possibly associate arrays? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.