PHP microtime()Function

PHP Date/TimePHP Date/Time Reference Manual

Examples

Return the microseconds of the current Unix timestamp:

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

Run example »

Definition and Usage

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

Syntax

microtime(get_as_float);

Parameter Description
get_as_float Optional. When set to TRUE, specifies that the function should return a float, otherwise it returns 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. Ifget_as_floatthe parameter is set to TRUE, it returns a float representing the current time in seconds since the Unix epoch, accurate to microseconds.
PHP Version: 4+
Changelog: PHP 5.0.0: Addedget_as_floatparameter.


PHP Date/TimePHP Date/Time Reference Manual Other Extensions