my
padding decimals with '0' question
Here is what is displayed, by my timer script:
Total execution time:
0.003175 sec
0.0024 sec
Now I like ALWAYS 6 decimals to be displayed:
0.003175 sec
0.002400 sec
What is the best way to do this '0'-padding?
I dont need to format the part to the left of '.'
just the 6 decimals
My script:
<?php
// start timer, beginning of config.php
$tim1 = array_sum(explode(' ',microtime()));
// do something script
// stop timer, in the end of footer.php
$tim2 = array_sum(explode(' ',microtime()));
$total_time = $tim2 - $tim1;
$total_time = round($total_time, 6); // round to 6 decimals
// echo in the FOOTER
echo 'Total execution time: ' . $total_time . ' sec';
?>