I’m doing a code that eliminates unneeded combinations such as I (ABCDE) do not want AAA BBB AB BA only want ABC ABD ABE …. so on, want it to be valid for any situation, example code that I did work that way: he makes a set of combinations (1-6) 3 on 3 … but I want him funciane of (1-15) with combinations of 4 on 4 or 10 to 10 …. See the example for better understanding.
$lista = array(1,2,3,4,5,6);
$b=1;
for ($i=0; $i<=3; $i++) {
for ($j=$b; $j<=4;$j++) {
// printf('valor do j = '.$j.'<br>');
for ($k=$j+1; $k<count($lista); $k++) {
printf($lista[$i].$lista[$j].$lista[$k].'<br>');
}
}
$b++;
}
Result
123
124
125
126
134
135
136
145
146
156
234
235
236
245
246
256
345
346
356
456
Original code: https://stackoverflow.com/a/2617080/661872 I just added
$lenpart.