Wednesday, March 4, 2015

Triangle Image in PHP

In this short article I will show you how to display an triangle image using PHP as our programming language. The code is just using two for loop statements to generate the image that we want.

If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Sample Output of Our Program

Program Listing

<html>
<title> Triangle Image </title>
<body bgcolor="lightgreen">
<h1> Triangle Image in PHP </h1>
<font face="arial" size="6">

<?php
error_reporting(0);
for($i=1;$i<=8;++$i)
 { 
 for($space=1;$space<=8-$i;++$space) 
 { 
 echo " &nbsp;  ";
 }
 while($k!=2*$i-1) 
 { 
 echo " <font color='red'>  * </font> ";
 ++$k;
 }
 $k=0; 
 echo "<br>";
 } 
 ?> </font>
 </body>
</html>


No comments:

Post a Comment