Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Example Interest Rates: Home Loan Variable: 1.89% (1.9%*) • Home Loan Fixed: 1.84% (2.11%*) • Fixed: 1.84% (2.11%*) • Variable: 1.89% (1.9%*) • Investment IO: 2.05% (4.36%*) • Investment PI: 1.58% (2.72%*)

Measure PHP Page Load Time

The following will measure page load time. Handy on MySQL functions, loops, APIs etc.

Place the following at the top of your page (or where you want to measure from).

1
<?php 
2
$time = microtime();
3
$time = explode(' ', $time);
4
$time = $time[1] + $time[0];
5
$start = $time;

Place the following at the bottom of your page (or where you want to measure to).

1
<?php 
2
$time = microtime();
3
$time = explode(' ', $time);
4
$time = $time[1] + $time[0];
5
$finish = $time;
6
$total_time = round(($finish - $start), 4);
7
echo 'Page generated in ' . $total_time . ' seconds.';

It makes sense to write them into functions so you can reuse them.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Washington)

  Want to have a chat?
 

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment