Home  >  Article  >  Backend Development  >  Usage and description of PHP function microtime()_PHP tutorial

Usage and description of PHP function microtime()_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:18:12688browse

Definition and Usage
The PHP function microtime() returns the current Unix timestamp and microseconds.
PHP function microtime() syntax
microtime(get_as_float)
PHP function microtime() parameters and description
get_as_float If the get_as_float parameter is given and its value is equivalent to TRUE, this function will return a Floating point number.
Note
The PHP function microtime() is only available under operating systems that support the gettimeofday() system call.
If called without optional parameters, this function returns a string in the format "msec sec", where sec is the number of seconds since the Unix epoch (0:00:00 January 1, 1970 GMT) , msec is the microsecond part. Both parts of the string are returned in seconds.
Example

Copy code The code is as follows:

echo (microtime()); //0.25139300 1138197510

The PHP function microtime() is usually used as follows:
Copy code The code is as follows:

$mtime= explode(' ',microtime());
$startTime=$mtime[1]+$mtime[0];     
echo $startTime; //1385976275.33

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/621699.htmlTechArticleDefinition and usage PHP function microtime() returns the current Unix timestamp and microseconds. PHP function microtime() syntax microtime(get_as_float) PHP function microtime() parameters and description get_as_float if...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn