RE: [PHP] Using while as for...

From: Date: Sat, 24 Feb 2001 08:06:22 +0000
Subject: RE: [PHP] Using while as for...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41432@lists.php.net to get a copy of this message
this is how you'd do it, in any of three ways, depending on the values you want to start/stop with. //counts from 0 to 10 $count=0; while ($count <= 10) { echo "$count, "; $count++; } print "<BR>"; //counts from 1 to 10 $count=0; while (++$count <= 10) { echo "$count, "; } print "<BR>"; //counts from 1 to 11 $count=0; while ($count++ <= 10) { echo "$count, "; } > -----Original Message----- > From: Felipe Lopes [mailto:php4@mailbr.com.br] > Sent: Wednesday, January 24, 2001 02:46 > To: php-general@lists.php.net > Subject: [PHP] Using while as for... > > > I was trying to code the following script using while instead of for, > but I'm havig a lot of problems...Is it possible to do what I want? > > for ($count = 0; $count <= 10; $count++){ > echo "Number is $count <BR>\n"; > } > > Could anyone tell me how is it with while instead of for?? > Thank you!! > > Felipe Lopes > MailBR - O e-mail do Brasil -- http://www.mailbr.com.br > Faça já o seu. É gratuito!!! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#41432) next »