← All built-ins / microtime()

microtime()

microtime(...$args): float

Parameters

Takes no arguments.

Return value

Current time as float seconds with microsecond precision.

Example

$t0 = microtime();
$acc = 0;
for ($i = 0; $i < 100000; $i++) { $acc += $i; }
echo microtime() - $t0 >= 0 ? "measured" : "clock-broke";
measured

See also

hrtime()time()