Web Analytics

PHP microtime() Function

Date/Time FunctionPHP 4+

The microtime() function returns the current Unix timestamp with microseconds. This function is typically used for performance benchmarking.

Syntax

microtime(bool $as_float = false): string|float

Parameters

  • as_float: If true, returns a float instead of a string. Defaults to false.

Return Value

By default, returns a string in the format "msec sec". If as_float is true, returns a float representing the current time in seconds since the Unix epoch accurate to the nearest microsecond.

Try It Online

Output
Click Run to execute your code

Related Functions

  • hrtime() - Get the system's high resolution time
  • time() - Return current Unix timestamp