PHP program to print alphabet pattern L

In this article write a PHP program to print alphabet pattern L. This Program first takes the numbers of rows and then prints pattern using nested for loops.

PHP program to print alphabet pattern L

<?php
echo "<pre>";
for ($row = 0; $row < 11; $row++) {
    for ($col = 0; $col <= 11; $col++) {
        if ($col == 1 OR ($row == 10 AND $col != 0 AND $col < 10)) {
            echo "*";
        } else {
            echo "&nbsp;";
        }
    }
    echo "<br/>";
}
echo "</pre>";
?>

Output:

alphabet pattern L

Leave A Reply

Your email address will not be published.