help with a while loop

hello i need to print a php script that has a countdown from 10 to 0 with a while loop. Each even number needs to be bold, after trying and trying this is what ive got

<?php $number = 0; $multipl = 0; while ($result < 10) $result = $number + $multipl; if ($result = 2 && $result == 0 && $result == 4 && $result == 6 && $result == 8 && $result == 10); { ?> <?php echo $result; $multipl++; $sum += $result; ?> <?php } elseif ($result = 1) || ($result == 3) || ($result == 5) || ($result == 7) || ($result == 9); echo $result; &multipl++; } ?>

could someone tell me what im doing wrong?

You will be surprised, but the code for your task is real short:
[php]<?php

$n=11;

while($n–){
echo $n%2?$n:(’’.$n.’’),’
’;
}

?>[/php]

is this what you want?

[php]<?php
$count=10;
while($count>=0)
{
if($count%2==0)
echo “”.$count."
";
else
echo $count."
";
$count–;
}
?>[/php]

sarthakpatel, your code is probably more self-explanatory :slight_smile:

thanks guys! it took three hours to do it wrong…so glad i came here for help :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service