PHP列出所有可能的具有特定数字的6位数字[重复]

This question already has an answer here:

How could I generate every possible number of a given amount of digits and using specific digits?

So basically, I would like to have a 6 digit number for example using only the numbers ['1','2','3']. I've tried a few methods of recursion, however, I can't get it to work correctly due to my other complication, which is adding a separator of "|" in between each 2 digits. So the list would be like so:

11|11|11
11|11|12
11|11|13
11|11|21
11|11|22
11|11|23

etc.. Would be appreciated if someone could point me in the right direction. Also a way of dumping each of the combinations into my MySQL database would be great.

</div>
查看全部
duanhuanbo5225
duanhuanbo5225
2013/03/29 17:08
  • loops
  • php
  • recursion
  • permutation
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复