mercredi 10 octobre 2018

Generate alphanumeric string with 2 letters and 5 digits. PHP

I'm generating a unique 5 digit code using the following.

$randomUniqueNumber = rand(10000,99999);

I need to change this to an alphanumeric number with 5 digits and 2 letters.

The below gives me an alphanumeric number, but not restricted to just 2 letters.

$generated = substr(md5(rand()),0,5);

How would I generate a random string with 5 digits, and two letters?




Aucun commentaire:

Enregistrer un commentaire