Best way to list Alphabetical(A-Z) using PHP
You can either do:
foreach (range('A', 'Z') as $char) {
echo $char . "\n";
}
Or:
for ($char = 'A'; $char <= 'Z'; $char++) {
echo $char . "\n";
}
range()
supports letters since PHP 4.1, so you can do this:
$azRange = range('A', 'Z');
foreach ($azRange as $letter)
{
print("$letter\n");
}
You can do it in this way as well: ASCII range used here.
for($i = 65 ; $i<=90; $i++)
{
echo chr($i);
}