PHP uniqid() Function
Complete PHP Misc Reference
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 |
Tips and Notes
Note: 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 (can be found in the String reference).
Example
The output of the code above could be:
Complete PHP Misc Reference
The Altova MissionKit is a suite of intelligent XML tools, including:
XMLSpy® – industry-leading XML editor
- Support for all XML-based technologies
- Graphical editing views, powerful debuggers, code generation, & more
MapForce® – graphical data mapping tool
- Drag-and-drop data conversion with code generation
- Support for XML, DBs, EDI, Excel® 2007, text, Web services
StyleVision® – visual stylesheet designer
- Drag-and-drop stylesheet design for XML & databases
- Output to HTML, PDF, RTF, Word 2007, & more
And more…
Try before you buy with a free fully functional 30-day trial
Download today
|