Jump to content

[SOLVED] newbie microtime help


Andy82

Recommended Posts

Hey,

 

I am learning PHP and am having a problem with using microtime.

 

I am trying to make a page load timer and the tutorials I have found use microtime.

 

The code I have come up with is:

 

<?php

error_reporting(0);

$page_load_start = microtime();

//the include files are here....

$page_load_end = microtime();
$page_load_time = $page_load_end - $page_load_start;
print("<!-- Time: " . $page_load_time . "-->");

?>

 

This produces a result that is about 10 digits long e.g. 1.230000000001

 

How would I make this number down to 1.23 seconds? I have looked at trim() and substr() but no luck.

 

Thank you for any help

 

Andy

Link to comment
https://forums.phpfreaks.com/topic/130800-solved-newbie-microtime-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.