yah these are the common example. when at the begining of any programming these are vary use full so that any can know how to manipulate loops whats the effect on out put if any changes are done some variation are applied.These are important at the beginning of programming.
can also try this to make diamond shape

PHP Code:
for($n=1;$n<=9;$n++) {
for($s=1;$s<=20-$n;$s++) {
echo " "; // " ";
}
for($m=1;$m<=$n;$m++) {
echo $m.' '; //echo $m.' ';
}
echo "\n"; //echo "<br>";
}
for($n=8;$n>=1;$n--) {
for($s=1;$s<=20-$n;$s++) {
echo " "; // " ";
}
for($m=1;$m<=$n;$m++) {
echo $m.' '; //echo $m.' ';
}
echo "\n"; //echo "<br>";
}
output
Code:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1