7 ms·
This uniqid() [1]? That appears to just be a microsecond timestamp. Definitely not globally unique by any stretch. [1] http://php.net/manual/en/function.uniqid
by stormbrew 12y ago
This uniqid() [1]? That appears to just be a microsecond timestamp. Definitely not globally unique by any stretch.
[1] http://php.net/manual/en/function.uniqid.php http://php.net/manual/en/function.uniqid.php
- ars 12y agoYes, if you need unique, and generated on the server (not remotely) then also include getmypid() and the IP address (or name) of the webserver (if you have more than one). Then use the option for more entropy in case the function is called more than one in a milliseconds. So in total: uniqid(gethostname().getmypid(), true); Will be unique if you give sane names to your machines.