PHP Alphabet Pattern 30

Last Updated:

PHP Alphabet Pattern 30

Try to print the following alphabet pattern using PHP.

Print This Output
ABCDE
BABCD
CBABC
DCBAB
EDCBA

Source Code

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

Share this Page

Meet the Author