Re: Unique Object Instance ID..?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 10 Jan 2009 23:31:29 +0000, Nathan Rixham wrote:

>[...]
>all I need is a completely unique id for each object instance that can 
>never be repeated at any time, even in a multiserver environment (and 
>without using any kind of incremented value from a db table or third 
>party app)

Have you looked at uniqid() ?

http://au2.php.net/manual/en/function.uniqid.php

I use it in a couple of places, converted to a more compressed format:

$id = explode('.', uniqid(rand(), TRUE), 2);
$id = base_convert($id[0], 16, 36) . '.' . base_convert($id[1], 16, 36);

Returns stuff like this:

9xm1k6oodk8o00s4wc.50nplu
-- 
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux