Display page execution time in PHP

Use this tiny code to check the execution time of your script.

<?php
// Write this line at the top of script
$start = (float) array_sum(explode(‘ ‘,microtime()));

/*
your code here
*/

// Write these lines at the bottom of script
$end = (float) array_sum(explode(‘ ‘,microtime()));
echo sprintf(“%.4f”, ($end-$start));
?>

If you want to increase the execution time limit then use these:

1. set_time_limit(int $seconds)

(Note – will not work in Safe Mode)

2. ini_set(‘max_execution_time’, 300); //300 seconds = 5 minutes

(Note – ini_set will not work in Safe Mode)

3. Via .htaccess

php_value max_execution_time 90

If you like the post & want to get more then Subscribe our blog posts. Subscribe SunwareTech.net RSS Feed Facebook Twitter Email

Both comments and pings are currently closed.

4 Responses to “Display page execution time in PHP”

  1. Arcelia says:

    I found the information on this site useful.

  2. beat maker says:

    Son of a gun! Every person knows that these are the hot ideas in the make any difference of.

  3. beat maker says:

    Could you electronic mail me with most suggestions & suggestions on how you produced your web page glimpse that amazing, I’d be appreciative.

  4. Magnificent goods from you, man. I’ve understand your stuff previous to and you’re just extremely fantastic. I actually like what you’ve acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can’t wait to read far more from you. This is really a great site.

Copyright © Sunware Technologies - Your web partner