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:[EMAIL PROTECTED]]
> Sent: Wednesday, January 24, 2001 02:46
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]