uniqid
Generate a unique ID
&reftitle.description;
stringuniqid
stringprefix""
boolmore_entropyfalse
Gets a prefixed unique identifier based on the current time in
microseconds.
This function does not create random nor unpredictable strings.
This function must not be used for security purposes.
Use a cryptographically secure random function/generator and
cryptographically secure hash functions to create unpredictable
secure IDs.
&reftitle.parameters;
prefix
Can 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_entropy
If 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.
&reftitle.returnvalues;
Returns the unique identifier, as a string.
&reftitle.examples;
uniqid Example
]]>
&reftitle.notes;
This function does not generate cryptographically secure tokens,
in fact without being passed any additional parameters the return
value is little different from microtime. If
you need to generate cryptographically secure tokens use
openssl_random_pseudo_bytes.
Under Cygwin, the more_entropy must be set
to &true; for this function to work.