Chris wrote:
David Robley wrote:
Chris wrote:
Pretty soon I'm going to be needing to generate a unique identifier in a
script. I'm looking into how to go about doing it now.
Have you looked at uniqid() ? http://php.net/uniqid
If two requests generate and ID at the same microsecond then the ID will
duplicate, and that will not work for me.
$unique_id = sha1( uniqid( mt_rand(), true ) );
That unique ID will be based on the current time in microseconds
prefixed by a random number generated by the Mersenne Twister. That is
*extremely* unlikely to duplicate, even at the same microsecond.
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php