-2

Possible Duplicate:
PHP: How to generate a random, unique, alphanumeric string?

I wish to generate Product Keys or Licenses using PHP. Is there a function that allow me to do generate unique numbers/IDs but at the same time make sure that there won't be a chance for duplicate?

Thank you.

Community
  • 1
  • 1
Ahmad Fouad
  • 3,957
  • 14
  • 45
  • 62

3 Answers3

2

You could use php's uniqid function to generate id's:

http://www.php.net/manual/en/function.uniqid.php

or leave that responsibility to the database engine, which will generate auto-incremented id values.

Headshota
  • 21,021
  • 11
  • 61
  • 82
1

Use a uniqid

Gabi Purcaru
  • 30,940
  • 9
  • 79
  • 95
0

You can use md5(timestamp), its always unique

Mike Mackintosh
  • 13,917
  • 6
  • 60
  • 87
Sandeep Manne
  • 6,030
  • 5
  • 39
  • 55