如何在阵列中分别选择2个项目,确保每个集合都已输出
Lets say I have an array of numbers: [1,2,3]
.
How can I loop through this array
to create an array of possible permutations.
I'm expecting outputs like:
[1,2]
, [1,3]
, [2,1]
, [2,3]
, [3,1]
, [3,2]
.
dsm1998
2018/09/24 14:40- laravel
- php
- 点赞
- 收藏
- 回答
满意答案