At 12:44 PM -0800 2/24/01, Felipe Lopes wrote:
>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!!


        $count = 0;
        while ($count <= 10) {
        echo "Number is $count <BR>\n";
        $count++;
        }

I think - if you're feeling obscure - that

        $count = 0;
        while
        (($count <= 10) && print 'Number is '.$count++." <br>\n")
        {}

will work too. As will - using alternate while syntax -

        $count = 0;
        while ($count <= 10):
        echo 'Number is '.$count++." <br>\n";
        endwhile;

See:

        http://www.php.net/manual/en/control-structures.while.php

for more info.

-steve


>Felipe Lopes
>MailBR - O e-mail do Brasil -- http://www.mailbr.com.br
>Faça já o seu. É gratuito!!!


--
+--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg                           University of California, Davis |
| [EMAIL PROTECTED]                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

--
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]

Reply via email to