i have function print calculate loading time of each page:
function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); $time_end = microtime_float(); $time = $time_end - $time_start;
but when echo $time, this:
5.60283660889e-5
but have value 0.000000000000xxxx, how can convert this? thank you.
there's no need "float" function, do
$time_start = microtime(true);
which returns value float.
to display decimals, try
printf('%.16f', $time);
which tells php format float 16 decimal places of output.
Comments
Post a Comment