Create a GUID in PHP

I recently had the need to generate a GUID as part of a PHP based application.  To do this I used the following code: function getGUID(){     if (function_exists(‘com_create_guid’)){         return com_create_guid();     }else{         mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.         $charid = strtoupper(md5(uniqid(rand(), true)));         $hyphen = chr(45);// “-”         $uuid = chr(123)// “{”             .substr($charid,…

Continue reading