Latest web development tutorials

PHP microtime () function

PHP Date / Time PHP Date / Time Reference Manual

Examples

Returns the current number of microseconds Unix timestamp:

<?php
echo(microtime());
?>

Running instance »

Definition and Usage

microtime () function returns the current number of microseconds Unix timestamp.

grammar

microtime( get_as_float);

参数 描述
get_as_float 可选。当设置为 TRUE 时,规定函数应该返回一个浮点数,否则返回一个字符串。默认为 FALSE。

technical details

return value: Default returns the string "microsec sec", where sec is since the Unix Epoch (0:00:00 January 1, 1970 GMT) from the number of seconds, microsec microseconds part. If get_as_float parameter is set to TRUE, it returns a floating point number from Unix epoch accurate to microseconds starting in seconds for the current time.
PHP version: 4+
Update log: PHP 5.0.0: New get_as_float parameters.


PHP Date / Time PHP Date / Time Reference Manual