I know there are many tutorials how to do this in PHP, but reason why I am writing this mini tutorial is one trick witch should help you a lot. By the way, do you know that execution time is also known as run time, And does movie runtime include previews? See it here to find out.
To calculate PHP script execution time is quite simple you just need to add below code to the top of your script code:
$time_start = microtime(true);
And at the end of string just add this:
$time_end = microtime(true); $time = $time_end - $time_start; echo "Script took $time seconds\n";
And then you run this script you should get PHP script execution time at the bottom you should see how long script was running to generate page.
To solve this problem is really simple all you have to do is to put script execution time to request headers:
Just remember header() function should be called before any output. If you have output before you can modify your code something like this:
ob_start(); $time_start = microtime(true); //... our script $time_end = microtime(true); $time = $time_end - $time_start; header('ExTime: '.$time) ob_end_flush();