PHP microtime() Function

Example

Returns the microsecond part of the current Unix timestamp:

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

Running Instance

Definition and Usage

The microtime() function returns the microsecond part 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 floating-point number, otherwise return a string. The default is FALSE.

Technical Details

Return Value:

The 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 microsecond part.

If get_as_float If the parameter is set to TRUE, it returns a floating-point number representing the current time since the Unix epoch (0:00:00 January 1, 1970 GMT) to the microsecond level, expressed in seconds.

PHP Version: 4+
Update Log: PHP 5.0.0: New get_as_float Parameters.