-1

我在这里很困惑。

我怎样才能循环这个:

从 0-9a-zA-Z 开始

对于上述范围内的 foreach 字母数字字符,我必须创建一个字符串

第一根弦将是

0000
... ( thousands of string generated between)
0009
... ( thousands of string generated between)
000a
... ( thousands of string generated between)
000z
000A
... ( thousands of string generated between)
000Z
.... ( thousands of string generated between)
ZZZA
... ( thousands of string generated between)
ZZZZ
4

1 回答 1

1

这是一种解决方案:

$corpus = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for( $i = 0; $i < strlen($corpus); $i++ )
   for( $j = 0; $j < strlen($corpus); $j++ )
      for( $k = 0; $k < strlen($corpus); $k++ )
         for( $l = 0; $l < strlen($corpus); $l++ )
              print substr($corpus, $i, 1).substr($corpus, $j, 1).substr($corpus, $k, 1).substr($corpus, $l, 1)."\n";
于 2012-08-24T04:49:58.687 回答