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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -

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