It’s hard for me to explain what I want here. So I’ll just try to explain this with code:
$numbers = [1,2,3,4,5,6];
$in_each = 2;
$combinations = superFunction($numbers, $in_each);
$combinations = [
[
[1,2],
[3,4],
[5,6]
],
[
[1,3],
[2,4],
[5,6]
],
[
[1,4],
[2,3],
[5,6]
]
];
$numbers = [1,2,3,4,5,6];
$in_each = 3;
$combinations = superFunction($numbers, $in_each);
$combinations = [
[
[1,2,3],
[4,5,6]
],
[
[1,2,4],
[3,5,6]
]
];
This is a superfunction. I need help creating. Note that the $ in_each variable is used here .
The function does not have to be over-efficient or even fault tolerant. I just need something to get me started.
I saw many different “combo” scripts here, but none of them have the ability to “group them” in this way.