开发者

List all possible combinations of letters, 8 up to 64 bit long string [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜