note 69035 added to function.microtime
| From: | admin at emuxperts dot no-ip dot info | Date: | Mon, 21 Aug 2006 02:37:40 +0000 |
| Subject: | note 69035 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116109@lists.php.net to get a copy of this message | ||
This little function comes in handy if you want a single integer when your server doesn't have
php >= 5.0
It returns seconds passed unix epoch to the microsecond. Or microseconds since unix epoch.
<?php
//A hack for PHP < 5.0
function utime($inms){
$utime = preg_match("/^(.*?) (.*?)$/", microtime(), $match);
$utime = $match[2] + $match[1];
if($inms){
$utime *= 1000000;
}
return $utime;
}
//Example:
print utime();
//Returns:
//1156127104.746352 Seconds
//Example two:
print utime(1);
//Returns:
//1156127104746352 Microseconds
?>
----
Server IP: 64.71.164.2
Probable Submitter: 68.214.56.42
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/69035
Del: integrated -- https://master.php.net/note/delete/69035/integrated
Del: useless -- https://master.php.net/note/delete/69035/useless
Del: bad code -- https://master.php.net/note/delete/69035/bad+code
Del: spam -- https://master.php.net/note/delete/69035/spam
Del: non-english -- https://master.php.net/note/delete/69035/non-english
Del: in docs -- https://master.php.net/note/delete/69035/in+docs
Del: other reasons-- https://master.php.net/note/delete/69035
Reject -- https://master.php.net/note/reject/69035
Search -- https://master.php.net/manage/user-notes.php