vendredi 28 avril 2017

Php : generate at least one digit and one letter

How can I generate at least one digit and one letter with let's say 5 strings characters?

I know I can randomly generate digits and letters with this :

echo $rand = substr(md5(microtime()),rand(0,26),5);

However, I've just checked it, and it can appear it only gives me simply 5 letters or 5 digits, and I'd like the rand to be always mixed with at least 1 digit and 1 letter.




Aucun commentaire:

Enregistrer un commentaire