Home / PHP / HOW TO CREATE THE STAR TRIANGLE IN PHP?

HOW TO CREATE THE STAR TRIANGLE IN PHP?

It is very easy to make a STAR Triangle in php. This is a type of matrix in which we can print rows and columns. You can make the STAR triangle by using (for loop) or (foreach) loop in php. ‘For’ or ‘foreach’ loop make it very easy in to make STAR Triangle. This can improve the logic of Fresher. Check below the programming syntax in front of

output:

* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*


for($i=0;$i<=5;$i++){ 
for($j=5-$i;$j>=1;$j--){
echo "*&nbsp;";
}
echo "<br>";
}
?>

 

*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *


for($i=0;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo "* ";
}
echo "
";
}
?>

 

*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *


for($i=0;$i=$i;$k--){
echo " ";
}
for($j=1;$j<=$i;$j++){
echo "*"." ";
}
echo "
";
}?>

 

About Sushil_kumar

Check Also

WordPress Live Chat Plugin v2.2.8

WordPress Live Chat Plugin v2.2.8 – Chat with your customers on your site for sales and support easily, and beautifully.  Now LiveChat uses real-time technology and you are able to install on unlimited websites. Demo: https://codecanyon.net/item/wordpress-live-chat-plugin/3952877 Last Update 7 March 17 Created 4 February 13 Compatible Browsers IE9, IE10, Firefox, Safari, Chrome Compatible With WPML […] The post WordPress Live Chat Plugin v2.2.8 appeared first on UnlockPress.com. ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Engineer Sushil Kumar is Stephen Fry proof thanks to caching by WP Super Cache