Welcome Guest, Not a member yet? Register   Sign In
Generating Unique ID
#5

[eluser]Randy Casburn[/eluser]
Rather than write all this stuff yourself, you could rely on what is already written for you. While the php function produces a string 13 characters long by default, it works and you could pull from it what you need. Here it is without any fancy foot work:

Code:
$unique =uniqid();

A better randomization would be:
Code:
$moreUnique = md5(uniqid(rand(), true));

That's directly out of the PHP manual. No credit to me.

If you are using MySQL, you could actully SELECT UUID from MySQL to get a standard UUID as well without any coding other than the query.

No reason to reinvent all this stuff.

Randy


Messages In This Thread
Generating Unique ID - by El Forum - 07-06-2008, 11:14 AM
Generating Unique ID - by El Forum - 07-06-2008, 11:23 AM
Generating Unique ID - by El Forum - 07-06-2008, 12:59 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:11 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:19 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:30 PM
Generating Unique ID - by El Forum - 07-06-2008, 06:07 PM
Generating Unique ID - by El Forum - 07-06-2008, 06:23 PM
Generating Unique ID - by El Forum - 07-06-2008, 07:32 PM
Generating Unique ID - by El Forum - 07-06-2008, 08:41 PM
Generating Unique ID - by El Forum - 07-06-2008, 10:18 PM
Generating Unique ID - by El Forum - 07-06-2008, 10:35 PM
Generating Unique ID - by El Forum - 07-06-2008, 11:48 PM
Generating Unique ID - by El Forum - 07-07-2008, 12:27 AM
Generating Unique ID - by El Forum - 07-07-2008, 12:53 AM
Generating Unique ID - by El Forum - 07-07-2008, 01:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB