microtime

int microtime(void) 

Returns the microsecond value for the current time.

Returns:

String containing microseconds and seconds

Description:

Gives the microseconds component of the current time. The string returned from this function is made of up the number of microseconds followed by the UNIX epoch time. To perform calculations on this function, you process the output to obtain an actual number. Another option would be to use gettimeofday() to obtain the microseconds component of the current time.

This function can be useful for simple benchmarking. By timing the start and finish of a process in your script, you can determine where the script may require optimization.

Version:

PHP 3, PHP 4

See also:

gettimeofday() 

Example:

Simple ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.