Demo of for loop

Creating pattern of stars in ten rows

*
**
***
****
*****
******
*******
********
*********
**********
Source code is here

for($i=1; $i<=10; $i++){
for($j=1;$j<=$i;$j++){
echo "*";
}
echo "<br>"; }

Another way to display the patterns

*---------
**--------
***-------
****------
*****-----
******----
*******---
********--
*********-
**********
Source code is here

for($i=1; $i<=10; $i++){
for($j=1;$j<=$i;$j++){
echo "*";
}
for($k=$j;$k<=10;$k++){
echo "-";
}
echo "<br>";
}

Tutorial on For loop



plus2net.com




Sagar

10-04-2015

Nice Example To Useful Developing Logic in php.......Thanks

Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer