← All built-ins / hrtime()
hrtime()
hrtime(...$args): int
Parameters
Takes no arguments.
Return value
Monotonic high-resolution counter in nanoseconds — for benchmarking.
Example
$t0 = hrtime();
$acc = 0;
for ($i = 0; $i < 1000000; $i++) { $acc += $i; }
$ns = hrtime() - $t0;
echo $ns > 0 ? "ns-ok" : "bad";ns-ok