generateID.php 382 B

1234567891011121314151617181920
  1. <?php
  2. /**
  3. * @return string Generated ID.
  4. */
  5. function generateID() {
  6. // Generate id based on the current microtime
  7. $id = str_replace('.', '', microtime(true));
  8. // Ensure that the id has a length of 14 chars
  9. while(strlen($id)<14) $id .= 0;
  10. // Return id as a string. Don't convert the id to an integer
  11. // as 14 digits are too big for 32bit PHP versions.
  12. return $id;
  13. }
  14. ?>