Home >Backend Development >PHP Tutorial >Usage and description of PHP function microtime()_PHP tutorial
Definition and Usage
The PHP function microtime() returns the current Unix timestamp and microseconds.
PHP function microtime() syntax
microtime(get_as_float)
PHP function microtime() parameters and description
get_as_float If the get_as_float parameter is given and its value is equivalent to TRUE, this function will return a Floating point number.
Note
The PHP function microtime() is only available under operating systems that support the gettimeofday() system call.
If called without optional parameters, this function returns a string in the format "msec sec", where sec is the number of seconds since the Unix epoch (0:00:00 January 1, 1970 GMT) , msec is the microsecond part. Both parts of the string are returned in seconds.
Example