PHP Programing Help... what am I doing Wrong?

Am trying to get my PHP Loop to work but for some reason am not able to get it to work.. am only a bigginer Please Some1 help me fix the code!
*my Loop Should fill the Array with the numbers 1 through 100...

<?php
$Count=0;
While ($Count > 100) {
$Number[] = $Count;
++$Count;
foreach ($Count as $CurNum)
echo "<p>$CurNum</p>";
}
?>
CaniDog I try what you said and it doesn't work and i get what your saying but According to my Teacher I need to fix the code and it should work so far No Luck getting it to work.. but thanks 4 ur help!
 
Try this:


<?php

$count = 1;
while ($count <= 100) {
$number[] = $count;
echo "<p>".$count."</p>";
$count++;
}

?>


In your code, you should set $count less than or equal to (<=) 100 since that's the limit you're trying to get to. The while loop won't run since $count is less than 100.

When you echo out $CurNum, concatenate the variable and string using period(.) like so:

"FOO" . $VAR . "BAR"
 
Back
Top