note 27811 added to function.uniqid
| From: | foo at example dot com | Date: | Thu, 19 Dec 2002 17:11:09 +0000 |
| Subject: | note 27811 added to function.uniqid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41123@lists.php.net to get a copy of this message | ||
UNIQID IS SLOW!!!
md5(microtime().posix_getpid()) is safer (and about 750x faster on an unloaded server) ... a single
uniqid takes about 20ms on a linux box due to this obscene snippet:
#if HAVE_USLEEP && !defined(PHP_WIN32)
if (!more_entropy) {
usleep(1);
}
#endif
--
http://www.php.net/manual/en/function.uniqid.php
http://master.php.net/manage/user-notes.php?action=edit+27811
http://master.php.net/manage/user-notes.php?action=delete+27811
http://master.php.net/manage/user-notes.php?action=reject+27811