Via: http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/
/**
* Generates an UUID
*
* @author Anis uddin Ahmad
* @param string an optional prefix
* @return string the formatted uuid
*/
function uuid($prefix = ”)
{
$chars = md5(uniqid(rand()));
$uuid = substr($chars,0,8) . '-';
$uuid .= substr($chars,8,4) . '-';
$uuid .= substr($chars,12,4) . '-';
$uuid .= substr($chars,16,4) . '-';
$uuid .= substr($chars,20,12);
return $prefix . $uuid;
}
Great function, does just what it says with no fuss and no mess
Thanks very much.
Спасибо понравилось ! Thanks !