Apr 26, 2004 #1 Edward999 Programmer Joined Dec 26, 2002 Messages 112 Location MY Hi I'm new to PHP. I need to know the meaning of $$variable. My source code as below: foreach($template_field as $key => $val) { $varname[] = $namevar = "template$key"; $$namevar = $valuez;} Why we use $$namevar?....Please help Thanks in Advance edward
Hi I'm new to PHP. I need to know the meaning of $$variable. My source code as below: foreach($template_field as $key => $val) { $varname[] = $namevar = "template$key"; $$namevar = $valuez;} Why we use $$namevar?....Please help Thanks in Advance edward
Apr 27, 2004 #2 frainbreeze Technical User Joined Jul 31, 2003 Messages 123 Location GB hello this link might help explain things http://www.phpbuilder.com/columns/robert20000928.php3 Upvote 0 Downvote
Apr 27, 2004 #3 DRJ478 IS-IT--Management Joined Aug 10, 2001 Messages 2,264 Location US Code: $varname = "myVar"; $value = 5; # now watch: $$varname = $value; echo $myVar; # output will be: 5 By using the $$ sign you assigned a value to a variable that itself comes from a variable. Ok? Upvote 0 Downvote
Code: $varname = "myVar"; $value = 5; # now watch: $$varname = $value; echo $myVar; # output will be: 5 By using the $$ sign you assigned a value to a variable that itself comes from a variable. Ok?
Apr 27, 2004 #4 sleipnir214 Programmer Joined May 6, 2002 Messages 15,350 Location US What we're talking about here is what the PHP online manual calls "variable variables" There is a section in the online manual which talks about variable variables. Want the best answers? Ask the best questions! TANSTAAFL!! Upvote 0 Downvote
What we're talking about here is what the PHP online manual calls "variable variables" There is a section in the online manual which talks about variable variables. Want the best answers? Ask the best questions! TANSTAAFL!!
Apr 27, 2004 Thread starter #5 Edward999 Programmer Joined Dec 26, 2002 Messages 112 Location MY Thanks a million everyone. edward Upvote 0 Downvote