Write an application that will display the output below using 2 for loops in PHP [closed]
1
12
123
1234
12345
123456
1234567
12345678
123456789
for ($i = 1; $i <= 9; $i++) {
for ($j = 1; $j <= $i; $j++) {
echo $j;
}
echo "\n";
}
Is that so hard?
<?php
for($i=1;$i<10;$i++)
{
for($j=1;$j<=$i;$j++)
echo $j;
echo '<br/>';
}
?>
精彩评论