Tuesday, September 21, 2021
How can we help?
< All Topics
Print

Simple Star Pattern in PHP

Here we go with our first simple and basic star pattern to increase our logic understanding. we are goona make a pattern with the “*” astric symbol with for loop and if else conditions.

We are goona make below star pattern:-

*

**

***

****

//Program for star pattern


<?php

  for($i=0;$i<4;$i++){

    for($j = 0; $j<$i;$j++){

       echo "*";

    }

    echo "<br>";

  }

?>

Previous How To Reverse String in PHP
Table of Contents