1
item 1 - How do I do that
Array
(
[0] => Array
(
[0] => 2
[1] => 4
[2] => 5
[3] => 6
[4] => 7
[5] => 9
.......
.......
[14] => 1
)
[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 - each set in a row)
2,4,5,6,7,9,..1
2,4,5,6,7,9,...
...............
...............
being the 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));
Isn’t that what you want? @Leocaracciolo who generates this data is the function you have in your question
– novic
Or do you want each one to fall a line? @Leocaracciolo
– novic
exact, each in a row
– user60252
a line 2,4,5,6,7,9,10,12,15,16,18,20,21,22,23 second line 2,4,5,6,7,9,10,12,15,1 6,18,20,21,22,24 Or a different comma separator for each group of 15 tens
– user60252
Ready @Leocaracciolo,,,,
– novic