PHP uniqid() function


Definition and Usage

The uniqid() function generates a unique ID based on the microtime (current time in microseconds).


Syntax

uniqid(prefix,more_entropy)


Parameter Description
prefix Optional. Specifies a prefix to the unique ID (useful if two scripts generate ids at exactly the same microsecond)Note: This parameter became optional in PHP 5
more_entropy Optional. Specifies more entropy at the end of the return value. This will make the result more unique. When set to TRUE, the return string will be 23 characters. Default
is FALSE, and the return string will be 13 characters long 

Example

echo uniqid();


The output of the code above could be:
4415297e3af8c  

No comments:

Post a Comment