I was looking for ways on how to list the alphabet without manually writing each one of them…
I guess I found an answer here http://xqus.com/printing-alphabet-php.
There were actually different methods being suggested. One that came from the author is by using range(). It can also be used with numbers.
Sample below:
Letters
<?php
foreach(range('a', 'z') as $letter) {
echo $letter;
}
?>
Numbers
<?php
foreach(range(0, 12) as $number) {
echo $number;
}
?>
<?php
foreach(range(0, 100, 10) as $number) {
echo $number;
}
And some suggested these:
array_walk(range('a', 'z'), "printf");
For UPPERCASE: for($i=65; $i<91; $i++) { echo chr($i); }
For lowercase: for($i=97; $i<123; $i++) { echo chr($i); }
I haven’t tried any methods yet but I guess I’ll be trying out range() instead