im inspired by this post:
PHP algorithm to generate all combinations of a specific size from a single set
im using the following code snippet:
function comb ($n, $elems) {
if ($n > 0) {
$tmp_set = array();
$res = comb($n-1, $elems);
foreach ($res as $ce) {
foreach ($elems as $e) {
array_push($tmp_set, $ce . $e);
}
}
return $tmp_set;
}
else {
return array('');
}
}
$elems = array('A','B','C', 'a', 'b', 'c', 0, 1, 2, 3);
$v = comb(7, $elems);
This works nice, but the problem is, that it creates me combinations like this:
(A, B, a) (A, B, C) (A, B, C, 0) (A, B, C, 1, 2)
i want to skip all these combinations of 3 for, i just want all combinations of 7 digits, fpr example:
(A, B, C, 0, 1, 2, a) (A, B, C, 0, 1, 2, B)
and so on ...
How could i tweak this code,
Thank you for your help!