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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -