Re: Variable Variables Help Please

From: Date: Thu, 31 Aug 2000 07:06:18 +0000
Subject: Re: Variable Variables Help Please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14530@lists.php.net to get a copy of this message
Jeff Lacy wrote: > Hello. I have three variables. The first one is $times. That is the > number of times my for loop has executed. The second variable is $value_1. > This is the value of a text box, let's say Alpha. My third variable is > $value_2. This is the value of my second text box, let's say Beta. I would > like to call something like $value_$times and have it go to be Alpha on the > first time of the loop and Beta on the second time of the loop. > $value_$times doesn't work. Does anyone know what would work? Thank you in > advance for all of your help You would do $variable_name = "value_$times"; $variable_value = $$variable_name; > P.S. I have tried $value_{$times} on the recommendation of a friend, but, > unfortunately, that doesn't work. That wouldn't work even on Perl. :-) > P.S.S. If I don't make any/much/enough sense, please reply to this or > email me at jeffdl@mn.mediaone.net. Thank you! -- | Heikki Korpela | heikki.korpela@wapit.com | tel. +358 50 3838 609 | | Software Developer, Wapit Finland | http://www.wapit.com | -- "Ain't working? Umm.. has the operating system been updated?"

« previous php.general (#14530) next »