note 54702 added to function.microtime
| From: | cristianDOTzuddas-NOSPAM-com at osu1 dot php dot net | Date: | Wed, 13 Jul 2005 07:42:27 +0000 |
| Subject: | note 54702 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91871@lists.php.net to get a copy of this message | ||
You can use microtime() to create unique numeric IDs:
<?
function unique_id() {
$now = (string)microtime();
$now = explode(' ', $now);
$unique_id = $now[1].str_replace('.', '', $now[0]);
unset($now);
return $unique_id;
}
Ex.: print(unique_id());
Returns: 1121243672080646700
?>
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54702
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54702&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54702&report=yes
Search -- http://master.php.net/manage/user-notes.php