Answer the question
In order to leave comments, you need to log in
How to make a generator of all possible combinations of characters of a given length?
There are 3 variables:
$start = 4;
$end = 6;
$sumb = [a,b,c,d,e,f,1,2,3,4,5,6,7,8,9,0];
function generator($start, $end, $sumbols){
$array = [];
while ($start != $end){ // Пока длина не максимальная
$pos = 0;
$word = '';
while ($pos != $start) {
foreach ($sumbols as $sumb) {
}
$pos++;
}
$array[] = $word;
$start++;
}
return $array;
}
$sumbols = explode('a,b,c,d,e,f,1,2,3,4,5,6,7,8,9,0');
var_dump(generator(4, 6, $sumbols));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question