PHP Tutorials
Page Generated in ...
To start off you need your main .php page that you want this code to be displayed on. Next you will need to add the following code between the </head> and <body> tags
<?php
//Starts the counter
$starttime = microtime();
//Starts the array
$startarray = explode(" ", $starttime);
//Telling the starttime to equal the arrays
$starttime = $startarray[1] + $startarray[0];
?>Once you finish adding that code to the /head and body tags add the following code on your site normally near the bottom or where you want to display the page generated in...
<?php
//Telling it to end the counter
$endtime = microtime();
//Telling the arrays to end
$endarray = explode(" ", $endtime);
//Telling the endtime to equal end arrays
$endtime = $endarray[1] + $endarray[0];
//Telling it the totaltime is the endtime+the starttime
$totaltime = $endtime - $starttime;
//Telling it to round the totaltime
$totaltime = round($totaltime,5);
//Display the time
echo "Page Generated in $totaltime seconds.";
?>And that is it! Short and sweet, you just made your site have a cool page generated in... code.
