Example 1 — Let PHP advance the letter
The outer loop stops at 'E'. The inner loop reprints from 'A' through the current end letter.
<?php
for ($end = 'A'; $end <= 'E'; $end++) {
for ($letter = 'A'; $letter <= $end; $letter++) {
echo $letter;
}
echo PHP_EOL;
} How It Works
$end++moves the end letter from A toward E.- The inner loop always restarts at
'A', so every row begins with A. echo $letterstays on the row.echo PHP_EOLstarts the next one.

