We have checked the execution time of your script.Following code Use
<?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
For ex.
It will determine the time taken for a php script to execute
<!-- put this at the top of the page start here-->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
;?>
<!-- put this at the top of the page end here-->
<!-- put other code and html in here -->
<!-- put this code at the bottom of the page start -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";
?>
<!-- put this code at the bottom of the page end -->
No comments:
Post a Comment