How to Measure PHP page load time
Using microtime() PHP function you will know exactly how much time is needed for your PHP code to be executed. Follow the steps below to put the PHP code on your web page:
The following code has to be put at the very end of the web page (or the end of the PHP code part)View Code PHP
1 2 3 4 5 6 7 8
<?php $time = microtime(); $time = explode(' ', $time); $time = $time + $time; $finish = $time; $total_time = round(($finish - $start), 4); echo 'Page generated in '.$total_time.' seconds.'; ?>
Now, when you access your web page you will know the time needed for it to execute. This is an example output of what you are going to see:
Page generated in 0.0031 seconds.
Hope you enjoyed!