Milliseconds is n*1000
:
<?php
$start = microtime(true);
usleep(1000000);
$end = microtime(true) - $start;
printf("Page was rendered in %f seconds", $end);
printf("Page was rendered in %f milliseconds", $end*1000);
printf("Page was rendered in %f microseconds", ($end*1000)*1000);
https://3v4l.org/kHmA3
Result:
Page was rendered in 1.000115 seconds
Page was rendered in 1000.115156 milliseconds
Page was rendered in 1000115.156174 microseconds
Edit: If you want values outputted like 0.10
etc you will need to change %f
to %s
and use round()
.
<?php
$start = microtime(true);
usleep(1000000);
$end = microtime(true) - $start;
printf("Page was rendered in %s seconds", round($end, 2));
printf("Page was rendered in %s milliseconds", round($end*1000, 2));
printf("Page was rendered in %s microseconds", round(($end*1000)*1000, 2));
https://3v4l.org/OfgJX
Result:
Page was rendered in 1 seconds
Page was rendered in 1000.12 milliseconds
Page was rendered in 1000121.12 microseconds
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…