Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP microtime() Function

PHP microtime() Function

PHP Date/Time PHP Date/Time Reference Manual

Example

Return the microseconds of the current Unix timestamp:

Run Example »


Definition and Usage

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

Syntax

microtime(

get_as_float);

Parameters Description
get_as_float Optional. When set to TRUE, specifies that the function should return a float instead of a string. Default is FALSE.

Technical Details

Return Value: By default returns the string "microsec sec", where sec is the number of seconds since the Unix epoch (0:00:00 January 1, 1970 GMT) and microsec is the microseconds part. If the get_as_float parameter is set to TRUE, returns a float representing the current time in seconds since the Unix epoch, accurate to microseconds.
PHP Version: 4+
Changelog: PHP 5.0.0: The get_as_float parameter was added.

PHP Date/Time PHP Date/Time Reference Manual