Fw: [PHP-WIN] php3 var question

From: Date: Thu, 15 Mar 2001 20:39:49 +0000
Subject: Fw: [PHP-WIN] php3 var question
Groups: php.windows 
Request: Send a blank email to php-windows+get-6080@lists.php.net to get a copy of this message
Try this: $var_1 = "one"; $var_2 = "two"; $var_3 = "three"; for($i=1; $i<4; $i++) { echo"$i. "; echo ${var_ . $i}; echo" <br>"; } ----- Original Message ----- From: "Mize, Robert" <Robert.Mize@COMPAQ.com> To: <php-windows@lists.php.net> Sent: Thursday, March 15, 2001 9:32 AM Subject: [PHP-WIN] php3 var question > If I have a set of variables named say: > $var_1 > $var_2 > $var_3 > > and I want to use a for loop to do something with the variables like: > for($i=1; $i<4; $i++){ > echo $var_$i; > } > > how do I do this so that $var_$i is interpreted as the variable ($var_1 > ect)? > > Thanks, > rob. > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.windows (#6080) next »