For a school asignment i need to make several patterns using nested for/while/dowhile loops.
But i really can't find what i'm doing wrong, nor is the school of any help..
I was hoping people here could assist me understanding the language. Because so far it hardly makes any sence to me.
This is the code so far:
Code:
<?php
$row2 = 1;
$col2 = 1;
for ($row = 1; $row <= 5; $row++)
{
for ($col = 1; $col <= 10; $col++)
{
echo "*";
}
echo "<br />";
}
echo "<br />";
while ($row2 <= 5)
{
while ($col2<=10) {
echo "*";
$col2++;
}
echo "<br />*";
$row2++;
}
?>
The nested for loop works fine!! (proud of myself... ), but the while loop isn't working and i can't figure out why.
this was supposed to be the result:
**********
**********
**********
**********
**********
but instead i get this:
**********
*
*
*
*
*
Anybody willing to help me?:)