Hey guys, I am trying to find a way to generate a UID to be placed in a URL. Right now I am looking at ways to create a UID's without using a sequential index from a db. This is what I have come up with.
As far as I can tell this should only create duplicates if they are both created in the same 1/10000th of a second.
function uid()
{
list($usec, $sec) = explode(" ", microtime());
$prec = 5;
$usec = round($usec, $prec);
$sec = round($sec - ($sec / 1.001), $prec);
$time = ($sec + $usec);
return base_convert($time, 10, 36);
}
Any ideas on why this function would be a bad idea?