1
I have developed an alphanumeric generator routine to be placed in a form field. However, it does not generate the numbering. Someone can help?
That field below:
<div class="guiaprest">
<label name="tPrest"> 2- Nº Guia no Prestador</label>
</div>
So I did some research on the Internet, and I found a model and I did this:
<?php
function rand_sem_num_repetido($qtd_numeros,$limite_min,$limite_max){
for($i=0;$i<=$qtd_numeros;$i++){
$aux=rand($limite_min,$limite_max);
if($i>=1){
while(in_array($aux,$index)){
$aux=rand($limite_min,$limite_max);
}
}
$index[$i]=$aux;
}
return $index;
}
?>
Numeric alpha is letters+nums right? There you are just generating numbers
– Miguel
Yes. True. I hadn’t noticed it. But even though it’s just numbers in the code above, it doesn’t generate anything.
– Inez Boldrin
You have to call the function. I ran well the code you put, maybe it just lacks the
implode()
, I will answer below– Miguel
Okay Miguel, I’ll be waiting.
– Inez Boldrin
A question:
rand_sem_num_repetido
This is because there’s supposed to be the same number repeated?– Miguel
Yes. When generating a new sequence, it cannot be the same as the previous one.
– Inez Boldrin