开发者

cleaner alphabet array in php

I'm creating an array of alphabet letters.. It's cluttering the code and doesn't look too good开发者_开发问答 for readability. Does PHP have a cleaner way or a function that already returns the alphabet in an array?

array ('a','b','c','d','e','f','g'..........................................);


You can use the range function which is used to create an array containing range of elements:

$alpha = range('a', 'z');

See it


Just so no one has to attempt it, you can also do the same with capital letters:

$alpha = range('A', 'Z');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜