Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Simple code of php for making tree using asterisk

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 140
    Comment on it

    Simple code of php for making tree using asterisk

    It is easy to make tree using php in less no. of line of code. Here are few line of code that will help you to get desired output by using for loop with three variable i,j and k or this can be explained by using the nested for function or it can be possible by using while function also. Below the code there is an output showing which is the result of above code. Try this code to your system it will help you to design the tree.

     

    </php
     for($i=0;$i<9;$i++)
     {
     	for ($j=1;$j<9-$i;$j++)
     	{
           echo"&nbsp;&nbsp";
     	}
        for ($k=0; $k<(2*$i-1); $k++) 
        { 
            echo " * ";
        }
          echo "<br>";
     }
    />
    

    Output:-           

                 *

            *    *    *

       *    *    *    *   *

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: