php - Creating unique GUID -


i have php code generating guid

mt_srand((double)microtime()*10000);//optional php 4.2.0 , up.       $charid = md5(uniqid(rand(), true));       $hyphen = chr(45);// "-"       $uuid = //chr(123)// "{"           substr($charid, 0, 8).$hyphen               .substr($charid, 8, 4).$hyphen               .substr($charid,12, 4).$hyphen               .substr($charid,16, 4).$hyphen               .substr($charid,20,12);       //.chr(125);// "}"       return $uuid;   

and storing in db,i wanted unique guids not present in db.should check guid each time when create db?please me generate unique guids not generate duplicate 1 chance


Comments

Popular posts from this blog

What can cause "Required Package 'IndyCore' not found" when compiling a Delphi 2010 project? -

Change the color of an oval at click in Java AWT -