RE: [PHP] A variable with a variable

From: Date: Fri, 11 Jan 2002 11:31:41 +0000
Subject: RE: [PHP] A variable with a variable
Groups: php.general 
Request: Send a blank email to php-general+get-80186@lists.php.net to get a copy of this message
> -----Original Message----- > From: Yoed [mailto:yoed@zarcrom.com] > Sent: 10 January 2002 23:01 > > I never really found the trick to this one yet, and wanted to > see what you > guys say is the best methods to call a variable that needs a variable. > > Say I have variables called $Var_1_Stat, $Var_2_Stat, and $Var_3_Stat > and I have a variable called $Nums thats value is either 1, 2, or 3. > How then would I go about calling $Var_Call=$Var_$Num_Stat ? Or > $Var_Call="$Var_$Num_State".... hmm not hat wouldn't work? > So what do you guys suggest? I suggest arrays -- is there a good reason why they won't do the job in this case? If it were at all possible, I'd reformulate the algorithm using these variables so they could be $Var_Stat[$Nums] ($Var_Stat[1], $Var_Stat[2], etc.). Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#80186) next »