例如 我正在寻找一个不断递增字母的功能 以“aaaaaa”开头并前往“aaaaab”并以“zzzzzz”结尾
答案 0 :(得分:2)
使用PHP的increment characters Perl style
功能$char = 'aaaaaa';
$endChar = 'zzzzzz';
$endChar++;
while ($char != $endChar) {
echo $char++, PHP_EOL;
}
答案 1 :(得分:0)
只需使用增量运算符
$start = "aaaaaa";
$end = "zzzzzz";
while($start ++ != $end) {
// print after every 10,000,000 million
(@$i ++ % 10000000 == 0) and print($start . PHP_EOL);
}
echo "Total ", number_format($i, 0);
输出
aaaaab
avwyxl
brtxuv
cnqwsf
djnvpp
efkumz
fbhtkj
fxesht
gtbrfd
hoyqcn
ikvozx
jgsnxh
kcpmur
kymlsb
lujkpl
mqgjmv
nmdikf
oiahhp
pdxgez
pzufcj
qvrdzt
rrocxd
snlbun
tjiarx
ufezph
vbbymr
vwyxkb
wsvwhl
xosvev
ykpucf
zgmszp
Total 308,915,775