To get the microseconds and timestamp, I use code from answer:
$milliseconds = round(microtime(true) * 1000);
This gives the current timestamp with microseconds, like 1528720042358
.
How do I only get the microseconds part?
To get the microseconds and timestamp, I use code from answer:
$milliseconds = round(microtime(true) * 1000);
This gives the current timestamp with microseconds, like 1528720042358
.
How do I only get the microseconds part?
To get just the part after the decimal point, don't pass true
as argument to microtime
and explode on a space:
list($msec) = explode(' ', microtime());
From there multiply or round the value to whatever range you need:
echo $msec * 1000000;