How to print A to Z or a to z alphabets in PHP!

The title looks silly but many of us does not know the answer even experienced PHP developers struggle sometime!! Yes, it is true but printing all the alphabets from A to Z is very easy, once you have a glance at the code you will say “Oh my god I never knew this but it is pretty simple!”

Before going to the tutorial, I want to say if you know C Programming or if you remember which you have studied in college or school then this is going to surprise you!

Here is the script to print  a to z:

the code is very simple, range() is a PHP function helps to create an array of elements within a range and in the above script we are fixing the range between a to z, then looping through each alphabets using foreach() function.

Pretty easy right?. Same as above you can also print A to Z just give the range like below:

Have Fun!

Related Posts

4 thoughts on “How to print A to Z or a to z alphabets in PHP!

  1. Hi I want to know how to write a php program using seven stars and place each star in a zig zag pattern??
    The output should be 7-stars placed in zig-zag pattern

Leave a Reply