把1,2,3,4,5,6这几个数3个一组,怎么用php循环出120种可能?如://123 124 125 126 //132 134 135 136 //142 143 145 146 //152,153,154,156 //162.163.164.165//213,214,215,216//231.234.235.236......等等
1 回答
月关宝盒
TA贡献1772条经验 获得超5个赞
a = [1, 2, 3, 4, 5, 6]for (let i = 0; i < a.length; ++i) { for (let j = 0; j < a.length; ++j) { if (j === i) continue; for (let k = 0; k < a.length; ++k) { if (k === i || k === j) continue; console.log(a[i], a[j], a[k]); } } }
- 1 回答
- 0 关注
- 860 浏览
添加回答
举报
0/150
提交
取消