1
I would like to create a simple script, just to know number of possible combinations.
It would not be to see the list of combinations, but only how many digits you can have, and the numbers and letters can be rethought. Ex:
$Valores = "1, 2";
$Digito = 2; //Quantidade de dígitos.
echo $Resultado = 6; //Possíveis combinações 1,2,12,21,22,11
Tiago, if I’m not mistaken, this is Combinatorial Analysis Algorithm. I’m sorry if I’m wrong. Have you checked if some of these questions attend to you?
– pss1suporte
@pss1support yes, it’s not the same thing.
– Tiago
@Maniero, how a direct question can get wider?
– Tiago
It is true, nor can it be broad, it is out of scope as [help/on-topic]
– Maniero
@Maniero, what is out of scope?
– Tiago
That’s math, just do it
qnt_valores ^ qnt_digitos
(pow()
in the case of PHP) for each digit amount. Perhaps there is another way...– Inkeliz
But the possible combinations have to have all the digits filled ? By your example it seems not. If you have to have it all filled out is as already said in comments:
pow(count(explode(',',$Valores)),$Digito)
– Isac