item 1 - How do I do this?
Array
(
[0] => Array
(
[0] => 2
[1] => 4
[2] => 5
[3] => 6
[4] => 7
[5] => 9
.......
.......
)
[1] => Array
(
[0] => 2
[1] => 4
[2] => 5
[3] => 6
[4] => 7
[5] => 9
........
........
)
[2] => Array
(
.....
.....
item 2 - turn this (15 numbers separated by commas)
2,4,5,6,7,8,...
2,4,5,6,7,9,...
...............
...............
being item 1 result of print_r(combinacoesDe(15,$dezenas));
thereof
$dezenas = array("2", "4", "5", "6", "7", "9", "10", "12", "15", "16", "18", "20", "21", "22", "23", "24", "25");
function combinacoesDe($k, $xs){
if ($k === 0)
return array(array());
if (count($xs) === 0)
return array();
$x = $xs[0];
$xs1 = array_slice($xs,1,count($xs)-1);
$res1 = combinacoesDe($k-1,$xs1);
for ($i = 0; $i < count($res1); $i++) {
array_splice($res1[$i], 0, 0, $x);
}
$res2 = combinacoesDe($k,$xs1);
return array_merge($res1, $res2);
}
print_r(combinacoesDe(15,$dezenas));