theloserboy

Segitiga Bintang Dalam PHP (2)

Nov 11th, 2011
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <html>
  2. <head><title> Latihan PHP </title></head>
  3. <body>
  4. <?php
  5.  
  6. $f=9;
  7. $temp = $f;
  8. $e=9;
  9. $tmp = $e;
  10.  
  11. for($a=1; $a<$f; $a++)
  12. {
  13. for($c=$a; $c<=$f; $c++)
  14. {
  15. echo "&nbsp;&nbsp;";
  16. }
  17. for($d=1; $d<=$a; $d++)
  18. {
  19. echo "*";
  20. }
  21. $temp--;
  22. echo "<br />";
  23. }
  24.  
  25.  
  26.  
  27. for($x=1; $x<=$e; $x++)
  28. {
  29. for($y=1; $y<=$x; $y++)
  30. {
  31. echo "&nbsp;&nbsp;";
  32. }
  33. for($z=$tmp; $z>=1; $z--)
  34. {
  35. echo "*";
  36. }
  37. $tmp--;
  38. echo "<br />";
  39. }
  40. ?>
  41. </body>
  42. </html>
  43.  
Advertisement
Add Comment
Please, Sign In to add comment