September 2001
Intermediate to advanced
768 pages
32h 45m
English
string uniqid(string prefix) Generates a unique ID.
Returns:
Unique value
Description:
This handy function creates a unique identifier based on the current number of microseconds. An optional prefix of up to 114 characters can be used to differentiate between several types of IDs or to provide another level of abstraction. This prefix is prepended to the generated ID. Since this function is based on the microtime, the variety of the generated IDs is not optimal; when the system time is known, a small amount of predictability comes into place. To generate hard-to-reproduce IDs, see the md5() function.
Example:
<?php // See the random number generator srand ((double) microtime () * 1000000); // Generate a 12-character ... |
Read now
Unlock full access