pTutorial

New way to learn PHP Example

PHP flag Example

Flag using loop

In this section we will make flag using for loop and star sign (*).

PHP complex loop example


<?php

for ( $i =1;$i =6;$i++ )
{
echo"               ";
 for ($x=1;$x<=20;$x++)
   { 
   echo"*";
  
   }
  
     echo"
"; } for ($j=1;$j<=10;$j++) { echo"               "; echo"***"; echo"
"; } $j=3; for ( $i = 1 ; $i <= 4 ; $i++ ) { for ( $x = 1 ; $x <= $j ; $x++ ) { echo"     "; } $j--; for ( $x = 1 ; $x <= 2*$i - 1 ; $x++ ) { echo"***"; } echo"
"; } ?>

Explanation

In this example we use seven for loop and echo statements to create this flag. It's complex example of for loop. It's very easy to understand.

Now you can check this script on click run button.


QUOTES OF THE DAY

Each day provides its own gifts.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER