可能重复:
PHP 采用所有组合
我正在考虑用 PHP 做一些东西来显示我所有的车牌组合。例如:
您有 3 个框可以填写最多 2 个值
喜欢
BOX1 BOX2 BOX3
75 PM M5
7S PH MS
Z5 PN H5
ZS RM HS
25 RH N5
2S RN NS
NOT BOX1+BOX1+BOX1
It needs to show me
ex. 75-PM-M5
ex. 75-PH-MS
ex. 75-PN-MS
ex. 75-PM-H5
ex. 75-PH-H5
ex. 75-PN-H5
So, BOX1+BOX2+BOX3
The PHP script needs to calculate all the combinations for BOX1+BOX2+BOX3
So BOX1 value1 and value2 are ONE value not two separate values.
In BOX2 value1 and value2 are also ONE value not two separate values and so on.
If I want all combinations of
BOX1'91' + BOX2'HF' + BOX3'PF'
BOX1'74' + BOX2'RT' + BOX3'YT'
It will calculate an amount of 2x2x2=8 combinations
ex. 91-HF-PF
ex. 91-HF-YT
ex. 91-RT-PF
ex. 91-RT-YT
ex. 74-HF-PF
ex. 74-HF-YT
ex. 74-RT-PF
ex. 74-RT-YT
示例密码
您需要输入 4 个密码才能使用您的 apm 卡
PIN1+PIN2+PIN3+PIN4
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8
9 9 9 9
0 0 0 0
所以你总共有 10x10x10x10=10.000 个组合,它必须显示所有组合
如果有人可以帮助我,我将不胜感激