Best way to list Alphabetical(A-Z) using PHP

Solution 1:

You can either do:

foreach (range('A', 'Z') as $char) {
    echo $char . "\n";
}

Or:

for ($char = 'A'; $char <= 'Z'; $char++) {
    echo $char . "\n";
}

Solution 2:

range() supports letters since PHP 4.1, so you can do this:

$azRange = range('A', 'Z');
foreach ($azRange as $letter)
{
  print("$letter\n");
}