note 61445 added to function.microtime
| From: | adiwicaksono at yahoo dot com | Date: | Fri, 03 Feb 2006 15:19:40 +0000 |
| Subject: | note 61445 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102932@lists.php.net to get a copy of this message | ||
<?
function uniqueTimeStamp(){
$Asec = explode(" ", microtime());
$Amicro = explode(".", $Asec[0]);
return ($Asec[1].substr($Amicro[1], 0, 4));
}
for($i = 0; $i < 10000; $i++){
print (uniqueTimeStamp());
print "\n";
}
?>
uniqueTimeStamp() is not Unique :)
Try this instread
$idmessage = substr(substr(uniqid(mktime(),4),16),0,8);
Unique
----
Server IP: 202.158.56.242
Probable Submitter: 202.147.193.2
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61445
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61445&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61445&report=yes
Search -- http://master.php.net/manage/user-notes.php