Hi,
In this script, I will show you how to get the execution time of a script an to display it.
This script is very simple, we will get the micro-seconds in the beginning and in the and of the script using the microtime function of PHP. Then, we will do a subtraction to get the elapsed time during the script execution.
This is the code to use:
<?php
function timer()
{
$time = explode(' ', microtime());
return $time[0]+$time[1];
}
$beginning = timer();
?>
<html>
<!-- The content of your page -->
Page generated in <?php echo round(timer()-$beginning,6); ?> seconds.
</body>
</html>
I hope this script will be useful.
Similar Scripts and Tutorials