Is there any way to get a php script that measures the localhost page rendering time. I have looked around but didn't find anything, maybe because I don't know how to search for this kind of script.
Update on original approved answer (for future people 'Googling' and cut-n-paste mojo):
For PHP 5.X+, you not only have to add 'true' as a parameter to both microtime() vars, but we don't have to divide it by 1,000 anymore. So the 2013 answer is:
Start of script:
$start = microtime(true);
Bottom of script:
$end = microtime(true);
$creationtime = ($end - $start);
printf("Page created in %.6f seconds.", $creationtime);
If you're looking to figure out how long it took your server to create the page (for example, to display this to the user), then you'll want to put this at the start of the code:
$start = microtime();
And then at the end put this:
$end = microtime();
$creationtime = ($end - $start) / 1000;
printf("Page created in %.5f seconds.", $creationtime);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With