Reply to Re: [PHP] GUID or any other unique IDs

Your name:

Reply:


Posted by "Richard Lynch" on 10/25/05 20:53

On Tue, October 25, 2005 4:01 am, Denis Gerasimov wrote:
> I am in a need of GUID generator but it seems that PHP doesn't have
> this as
> a built-in feature.

There is some discussion here you may find useful:

http://www.php.net/uniqid

> I really need "true" unique identifiers - md5() hash is not OK because
> of
> the "birthday paradox".

If you already have a database connection you can simply use a
sequence (or auto_increment in MySQL)

But that assumes you are willing to have predictable IDs, which you
might not.

> Can anyone recommend a way for solving this trouble?

You could use md5() and track every ID you hand out in a UNIQUE column
in a db, and simply generate another random md5() if you happen to run
into a duplicate.

The probability that you'd generate too many duplicate random md5()s
in a row for performance to be an issue is pretty small, if you
already have database activity going on.

--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация