php – Generating random but unique numbers for reference ID – Stack Overflow

php – Generating random but unique numbers for reference ID – Stack Overflow

Why not just preface your random number with a Unix timestamp? This will ensure uniqueness.

$random = time() . rand(10*45, 100*98);

Otherwise, you can store your numbers in a file. If you can, store them in a database.

via php – Generating random but unique numbers for reference ID – Stack Overflow.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s