PHP Alphabet Pattern 27

Last Updated:

PHP Alphabet Pattern 27

Try to print the following alphabet pattern using PHP.

Print This Output
    A
   A B
  A B C
 A B C D
A B C D E

Source Code

PHP Compiler
<?php $alpha = range('A', 'Z'); $k = 0; for($i=0; $i<=4; $i++) { for($j=4; $j>$i; $j--) echo "&nbsp;&nbsp;"; for($k=0; $k<=$i; $k++) echo "<div>" . $alpha[$k] . "</div>"; echo "<br>"; } ?>

Share this Page

Meet the Author