PHP Alphabet Pattern 26

Last Updated:

PHP Alphabet Pattern 26

Try to print the following alphabet pattern using PHP.

Print This Output
ABCDE
BCDEA
CDEBA
DECBA
EDCBA

Source Code

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

Share this Page

Meet the Author