PHP uniqid() Function

The uniqid() function generates a unique ID based on the microtime (current time in microseconds).The generated ID from this function is not optimal, because it is based on the system time. To generate an extremely difficult to predict ID, use the md5() function.

string uniqid ([ string $prefix = "" [, bool $more_entropy = FALSE ]] )

Gets a prefixed unique identifier based on the current time in microseconds.

Example -

ParameterDescription
prefixCan be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond.With an empty prefix, the returned string will be 13 characters long. If more_entropy is TRUE, it will be 23 characters.
more_entropyIf set to TRUE, uniqid() will add additional entropy (using the combined linear congruential generator) at the end of the return value, which increases the likelihood that the result will be unique.

Return Values

Returns timestamp based unique identifier as a string.