Re: Using while as for...

From: Date: Sat, 24 Feb 2001 21:50:26 +0000
Subject: Re: Using while as for...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41517@lists.php.net to get a copy of this message
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 | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+

« previous php.general (#41517) next »