Calculate page loading time

Sometimes you need to debug your php files you have created.Then there you can measure your pages’s time complexity that how long it takes to load.You can calculate your page loading time using PHP script.

For this there is used microtime() in PHP which is used for returns the current Unix timestamp with microseconds.

So let’s see the program.Add this following code at top of  your any php page.

[php]<?php

functon load();

<em id="__mceDel"> $total_time = ($finishing_time – $initial_time);</em>

echo "<b>The loading time of this page is:</b>".round($total_time)." seconds";

function load(){

$m_time = explode(" ",microtime());

$m_time = $m_time[0] + $m_time[1];
$m_time = explode(" ",microtime());

$m_time = $m_time[0] + $m_time[1];

$initial_time = $m_time;
$m_time = explode(" ",microtime());

$m_time = $m_time[0] + $m_time[1];

$finishing_time = $m_time;

}

?>

[/php]

Now see the output of loading time of your page.

hhhhhhhhhhhhhhhhhhh

Leave a Comment

Your email address will not be published.