Home     Articles & Projects     Products & Web Services

random unique 10 digit string

I need to come up with a way to make a user 10 digit unique ID string.
The ID must not already be in the DB, if you know how please help.

Hi Russell, Have a look at

Hi Russell,

Have a look at uniqid() which should do what you want (assuming that numbers and letters are OK) - a neat thing to do is to use strtoupper() and just take the last 10 characters, for example:

$userID = substr(strtoupper(uniqid()),-10) 

Hope this helps!
Cheers,
David.