home

Search A2Z 24

Get all Alphabetic characters(A to Z) in PHP

X

For capital letters A-Z (65 to 90) & for small letters a-z (97-122)

<?php
//For capital letters A-Z (65 to 90) & for small letters a-z (97-122)
for($alpha = 65; $alpha <= 90; $alpha++){
       echo chr($alpha);
}
?>

For capital letters A-Z (A to AA) & for small letters a-z (a to aa)

<?php
//For capital letters A-Z (A to AA) & for small letters a-z (a to aa)
for ($alpha = 'A'; $alpha !== 'AA'; $alpha++){
	echo $alpha;
}
?>

For capital letters set range A-Z & for small letters set range a-z

<?php
//For capital letters set range A-Z & for small letters set range a-z
foreach(range('A','Z') as $alpha){
	echo $alpha;
}
?>

For capital letters A-Z set range (65 to 90) & for small letters a-z set range(97-122)

<?php
//For capital letters A-Z set range (65 to 90) & for small letters a-z set range(97-122)
foreach(range(65,90) as $alpha){
	echo chr($alpha);
}
?>

About Author

by Admin

Share your thoughts!

Login as a member to access comment posting block !! click-here

Thoughts From Other Users (0)

No Comments

×