note 60515 added to function.microtime
| From: | junk at plaino dot com | Date: | Mon, 09 Jan 2006 23:35:11 +0000 |
| Subject: | note 60515 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101470@lists.php.net to get a copy of this message | ||
Here's a quick function to output a unique number. Good for MySQL / SQL idexes and unique id
values.
function uniqueTimeStamp_float(){
$Asec = explode(" ", microtime());
$Amicro = explode(".", $Asec[0]);
return ($Asec[1].".".substr($Amicro[1], 0, 4));
}
print (uniqueTimeStamp_float());
// outputs a unique something like:
// 1136849268.0180
function uniqueTimeStamp(){
$Asec = explode(" ", microtime());
$Amicro = explode(".", $Asec[0]);
return ($Asec[1].substr($Amicro[1], 0, 4));
}
print (uniqueTimeStamp());
// outputs a unique something like:
// 11368492680180
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60515
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60515&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60515&report=yes
Search -- http://master.php.net/manage/user-notes.php