The following code is placed at the very top of the file. It checks the time when the file begins to load. The time is saved in the variable $start_time.
<?php $start_time = explode(" ", microtime()); $start_time = $start_time + $start_time; ?>
The following code is added at the bottom of the document. The variable $end_time saves the time when the page is fully loaded. Loading time is calculated by checking how long it has been between $start_time and $end_time. This is rounded to three decimal places to limit it somewhat. The loading time is saved in the variable $total_time which can then be displayed.
<?php $end_time = explode(" ", microtime()); $end_time = $end_time + $end_time; $total_time = round(($end_time - $start_time), 3); echo("Page loaded in ".$total_time."s"); ?>