Re: Unique Numbers

From: Date: Mon, 18 Feb 2002 21:59:39 +0000
Subject: Re: Unique Numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85293@lists.php.net to get a copy of this message
Thanks for the input. I just replaced time() with uniqid(""), and I think that will work great. Steven J. Walker Walker Effects www.walkereffects.com steve@walkereffects.com On Monday, February 18, 2002, at 01:38 PM, Lars Torben Wilson wrote:
On Mon, 2002-02-18 at 13:14, Steven Walker wrote:
Is it safe to use time() to generate a unique id number? My thinking is that the call to the server will take enough time that no two users will get the same time stamp (although they may be very close). Even though the likelyhood of two users entering at the same time is very slim, I don't want to take the chance. What about microtime()?
No, time functions suck for this. See uniqid() for this kind of thing: http://www.php.net/manual/en/function.uniqid.php Cheers, Torben
-- Torben Wilson <torben@php.net> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506


« previous php.general (#85293) next »