PHP - Number: Generating Unique IdentifiersTag: number, unique identifiers Category: PHP Basicpost: 16 Mar 2008 read: 64 PHP Number Tips - Part 14: If you want to generate a unique, random numeric identifier that cannot be easily guessed, you can use a combination of PHP's uniqid( ), md5( ), and rand( ) functions:
PHP's uniqid( ) function returns an alphanumeric string based on the current time in microseconds and because the identifier is based in a time value, so there is a very slight possibility of two identical identifiers being generated at the same instant. There are to reduce this possibility and add a random element to the procedure by combining the call to uniqid( ) with a call to rand( ) and md5( ). |
| | Give Your Opinion | Recommend |
|

