Re: Creating Unique Values
| From: | Andy Woolley | Date: | Wed, 04 Oct 2000 16:51:41 +0000 |
| Subject: | Re: Creating Unique Values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18614@lists.php.net to get a copy of this message | ||
Thanks Andrew,
I decided to use the function called erm.... the one that I can never
remember what it's called without looking in the manual.
microtime(); that's it.
Heres what I did:
$uniquevalue = microtime();
$uniquevalue = ereg_replace ("\.", "", $uniquevalue); #get rid of the
period.
setcookie("cookieset", $uniquevalue);
As microtime() takes it start time from the Unix Epoch (0:00:00 January 1,
1970 GMT) the chances of a duplicate are......shall we say slim.
Thanks Mate.
Andy
M.D.
www.databasewatch.com
----- Original Message -----
From: "Andrew Hill" <ahill@openlinksw.com>
To: "Andy Woolley" <andy@milonic.com>; <php-general@lists.php.net>
Sent: Wednesday, October 04, 2000 5:28 PM
Subject: RE: [PHP] Creating Unique Values
> Why don't you just use unix time? This is unique at a certain point, and
> will never be repeated.
>
> Best regards,
> Andrew
> ----------------------------------------------------
> Andrew Hill
> Director Technology Evangelism
> OpenLink Software
> http://www.openlinksw.com
> XML & E-Business Infrastructure Technology Provider
>
>
> > -----Original Message-----
> > From: Andy Woolley [mailto:andy@milonic.com]
> > Sent: Wednesday, October 04, 2000 12:30 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] Creating Unique Values
> >
> >
> > Greetings people,
> >
> > Does any have a script that creates unique values in PHP.
> >
> > What I need is to do is create a value that will never be used again. I
> > think that a combination of date, time, milliseconds and some random
chars
> > would be good.
> >
> > If I can't get one pre-done, then I'll build one and post it to
> > you all, it
> > shouldnt be too complicated to do, but I'm in a rush and I'm
> > getting lazy in
> > my old age.
> >
> > Cheers Folks.
> >
> > Andy Woolley
> > M.D.
> > www.databasewatch.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> >
>
>