RE: [PHP] Calling a Variable in a weird Way

2002-03-07 Thread Ford, Mike [LSS]
> -Original Message- > From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] > Sent: 07 March 2002 05:52 > > for ($i=1; $i < 12; $i++) { > echo state_$i; // This would print out either Yes No or Maybe. > } Close -- it's actually: echo ${"state_$i"}; (For the record, these

RE: [PHP] Calling a Variable in a weird Way

2002-03-06 Thread Jason Murray
> for ($i=1; $i < 12; $i++) { > echo state_$i; // This would print out either Yes No or Maybe. > } What you actually want is: for ($i=1; $i < 12; $i++) { $mystate = "state_".$i; echo $$mystate; // This would print out either Yes No or Maybe. } $$X tells PPH to use