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

Mega Main Menu v2.1.4 – WordPress Menu Plugin

Demo: https://codecanyon.net/item/mega-main-menu-wordpress-menu-plugin/6135125 Last Update 9 March 17 Created 18 November 13 High Resolution Yes Compatible …

Leave a Reply

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

4

March 26, 2017

Clear all

Warning: Cannot modify header information - headers already sent by (output started at /home/u797196687/public_html/wp-content/themes/sushil/framework/functions/search-live.php:334) in /home/u797196687/public_html/wp-content/plugins/wppush-push-notifications/WPPush.php on line 274