List all possible combinations of letters, 8 up to 64 bit long string [closed]
How to list all possible letter combinations (from an alphabet: "qwertyuiopasdfghjklzxcvbnm"), like:
q
w
开发者_Python百科e
r
t
y
u
o
p
s
d
f
g
h
j
k
l
x
c
v
b
n
m
qq
qw
qe
qr
qt
qu
up to 64 bit long strings? So the last one would be String(8):
mmmmmmmm
for($a=97; $a<123; $a++){
for($b=97; $b<123; $a++){
for($c=97; $c<123; $b++){
for($d=97; $d<123; $a++){
for($e=97; $e<123; $a++){
for($f=97; $f<123; $a++){
for($g=97; $g<123; $c++){
for($h=97; $h<123; $d++){
echo chr($a).chr($b).chr($c).chr($d).chr($e).chr($f).chr($g).chr($h);
}}}}}}}}
Haven't tried though. Its straight forward one. for short code use recursion or something like that. by the way this only shows 8 char long numbers so for shorter ones you need more code, but the idea is about the same.
精彩评论