PHP uniqid () function
Definition and Usage
uniqid () function is based on the current time in microseconds, generating a unique ID.
Note: Due tothe time-based system, generated by the function ID is not optimal. To generate absolute unique ID, please use the md5 () function.
grammar
uniqid( prefix,more_entropy )
参数 | 描述 |
---|---|
prefix | 可选。规定唯一 ID 的前缀。如果两个脚本恰好在相同的微秒生成 ID,该参数很有用。 |
more_entropy | 可选。规定位于返回值末尾的更多的熵。这将让结果更具唯一性。当设置为 TRUE,返回字符串为 23 个字符。默认是 FALSE,返回字符串为 13 个字符。 |
technical details
return value: | Unique identifier is returned as a string. |
---|---|
PHP version: | 4+ |
Update log: | In PHP 5.0 in, prefix parameter became optional. In the PHP 4.3.1, prefix 114-character length limit increased. |
PHP Misc Reference Manual