This small code can be quite helpful if you need to find out what is taking so long to load in your script(s).
It will determine the time taken for your PHP script(s) to execute, accurate to 0.000000000000001 seconds.

The Code

// put this at the top of your page/script
$exectime = microtime();
$exectime = explode(" ",$exectime);
$exectime = $exectime[1] + $exectime[0];
$starttime = $exectime;

/*
 *   place your script(s) to here
 */


// put this at the bottom of your page/script
$exectime = microtime();
$exectime = explode(" ",$exectime);
$exectime = $exectime[1] + $exectime[0];
$endtime = $exectime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";

…and that’s all! Happy debugging!