How to generate a Unique ID
Posted on August 30, 2008, under PHP,
Bookmark it
A function that generates an unique id. It’s useful when you need to generate keys that have to be unique.
<?php
function GenerateUniqueID()
{
return md5(uniqid(rand(),1));
}
echo GenerateUniqueID(); // returns a 32 characters unique string
?>
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- August 30, 2008
- article by Gabriel C.
- 1 comment
Related Posts
-
How to generate a random password in PHPat August 29, 2008 with 2 comments
-
Image Slider with Unique Transition Effects: jQuery Coin Sliderat April 7, 2010 with 1 comment
-
Format text into a SEO Friendly Stringat August 28, 2008 with 2 comments
-
Generate & Download Free Icons: Iconizerat January 12, 2010 with 1 comment
-
Create, Customize and Send Newsletters: MeeNewsat August 3, 2009 with 3 comments

One Reply to "How to generate a Unique ID"
July 15, 2009 at 10:16 PM
Thanks for a short but helpful bit of information.