2016-03-12 22:51:33 +00:00
|
|
|
<?php
|
|
|
|
|
2016-03-24 17:41:33 +00:00
|
|
|
/**
|
|
|
|
* @return string Generated ID.
|
|
|
|
*/
|
2016-03-12 22:51:33 +00:00
|
|
|
function generateID() {
|
|
|
|
|
|
|
|
// Generate id based on the current microtime
|
|
|
|
$id = str_replace('.', '', microtime(true));
|
|
|
|
|
|
|
|
// Ensure that the id has a length of 14 chars
|
|
|
|
while(strlen($id)<14) $id .= 0;
|
|
|
|
|
2016-03-24 17:23:19 +00:00
|
|
|
// Return id as a string. Don't convert the id to an integer
|
|
|
|
// as 14 digits are too big for 32bit PHP versions.
|
|
|
|
return $id;
|
2016-03-12 22:51:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|