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 \n";
>}
>
>Could anyone tell me how is it
you can do
while($count<=10)
{
echo "Number is $count \n";
$count++;
}
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Felipe Lopes [mailto:[EMAIL PROTECTED]]
Sent: Wed
Whups, forgot a blasted semicolon...
$count = 1;
while($count < 10)
{
echo "Number is $count \n";
$count++;
}
Cheers,
Andrew
On 2/24/01 12:20 AM, "Andrew Hill" <[EMAIL PROTECTED]> wrote:
> $count = 1;
>
> while($count < 10)
> {
>echo "Number is $count \n";
>$coun
$count = 1;
while($count < 10)
{
echo "Number is $count \n";
$count++
}
> for ($count = 0; $count <= 10; $count++){
> echo "Number is $count \n";
> }
>
> Could anyone tell me how is it with while instead of for??
> Thank you!!
Best regards,
Andrew
--
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 "";
//counts from 1 to 10
$count=0;
while (++$count <= 10) {
echo "$count, ";
}
pr
5 matches
Mail list logo