TechniqueYou can use uniqid() , getmypid() , md5() , and microtime () to generate a random ID: <?php $id = md5(uniqid(microtime(), 1)) . getmypid(); ?> CommentsIn this example, the getmypid() function is optional ”it's there to make sure that IDs generated by different server processes are not the same. But because md5() here depends on uniqid() , which in turn depends on microtime() , there is a very, very slim chance of ever generating the same ID. |