OTARIKI OTARIKI - 5 months ago 26
PHP Question

What possible characters may returned as a result from PHP's uniqid()?

What possible characters may contained result from function uniqid() ? as I understood, this is only alphanumeric characters, but need confirm from you. So, this is so?

P.S. In documentation http://php.net/manual/en/function.uniqid.php I dont see info about this

Answer

In the comments of the same documentation page : "As others below note, without prefix and without "added entropy", this function simply returns the UNIX timestamp with added microsecond counter as a hex number; it's more or less just microtime(), in hexit form."

So it returns only hexadecimal characters, e.g. 0-9 a-f.

Edit: As Vulcan pointed out in the comments below: $more_entropy, when true, appends a period and some 0-9 characters.

Comments