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 Link to comment https://forums.phpfreaks.com/topic/97988-double-dollar-sign-meaning/ Share on other sites More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 Variable variables. Link to comment https://forums.phpfreaks.com/topic/97988-double-dollar-sign-meaning/#findComment-501352 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 Link to comment https://forums.phpfreaks.com/topic/97988-double-dollar-sign-meaning/#findComment-501354 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? Link to comment https://forums.phpfreaks.com/topic/97988-double-dollar-sign-meaning/#findComment-501384 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.