问题
I believe there is something like 67 million combination of two character strings using only the letters of the alphabet.
I basically want an array in PHP containing something like the following
Array
(
[1] => AA
[2] => AB
[3] => AC
[4] => AD
[5] => AE
[6] => AF
[7] => AG
[8] => AH
[9] => AI
[10] => AJ
.... and so on
)
回答1:
with two loop you can do this:
<?php
$arr = array('A', 'B', 'C');
foreach ($arr as $value1) {
foreach ($arr as $value2) {
echo $value1.$value2;
}
}
?>
Then you can put the result in an array.
来源:https://stackoverflow.com/questions/17934490/php-generate-every-2-character-combo-of-the-alphabet-twist-duplicates-letters