php : Generating Unique ID’s
It has always been an issue on how to handle the ID’s. How to generate them and how to keep them unique. To sort out this issue here is the function from php which can help allow do this.
- // generate unique string
- echo md5(time() . mt_rand(1,1000000));
There is actually a PHP function named uniqid() that is meant to be used for this.
Since the function is dependent upon the time, the initial few characters could be similar. Because of which one may think there could be a chance of duplicating the Ids. In order to resolve this simply add 1 more parameter to it and this becomes unique.

