Link to home
Start Free TrialLog in
Avatar of TotallyMe
TotallyMe

asked on

Need a PHP function to generate a range() A to ZZZZ

I'm having trouble creating a PHP function that will output every possible letter combination, for example

a
b
c
......... etc
......... etc
........ then
aa
ab
ac
ad
......... etc
......... etc
........ then
aaa
aab
aac
......... etc
......... etc
........ then
zzx
zzy
zzz


I need the function to accept a $depth value, for example a depth of 3 would end at ZZZ.

I know the PHP range function is useful range('a','z');
but this only creates an array with A-Z

Could anyone help me with this. Thanks in advance

ASKER CERTIFIED SOLUTION
Avatar of ycTIN
ycTIN
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TotallyMe
TotallyMe

ASKER

Worked great, thank you.