note 22122 deleted from function.set-time-limit by nlopess
| From: | nlopess@php.net | Date: | Wed, 04 Feb 2004 17:01:42 +0000 |
| Subject: | note 22122 deleted from function.set-time-limit by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64639@lists.php.net to get a copy of this message | ||
Note Submitter: opaf@yahoo.com
----
It seems that set_time_limit does take into account the time spent in functions like sleep:
<?PHP
echo "<html>\n" ;
echo "<body>\n" ;
echo "Time limit: 10 seconds<br/>" ;
echo "Timer: <span id=\"counter\"></span><br/>\n" ;
echo "</html>" ;
set_time_limit ( 10 ) ;
$w = 0 ;
while ( true ) {
$w ++ ;
flush () ;
sleep ( 1 ) ;
echo "<script>document.all.counter.innerHTML =
\"$w\";</script>\n";
}
?>
The above script will never reach 10 seconds.