how to print this pattern in php.

A A,B A,B,C


2 Answers
1-2 of  2
2 Answers
  • <?php
    $b ="ABCDE";
     $a = strlen($b);
    for($i=0;$i<$a;$i++)
    {
        for($j=0;$j<=$i;$j++)
        {
            echo $b[$j];
    if($i==$j)
    {
    echo "";
    }
    else
    {
    echo ",";
    }
    }
    echo "<br>";
    }

    ?>

     

Php

Didn't get the answer.
Contact people of Talent-Php directly by clicking here