Re: Setting execution time for a loop
| From: | zavaboy | Date: | Wed, 10 Sep 2003 10:25:59 +0000 |
| Subject: | Re: Setting execution time for a loop | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162151@lists.php.net to get a copy of this message | ||
// Ok, I have a loop:
for ($i = $Date; $i >= $sDate; $i--)
// Somthing like this is inside the loop:
if ($Exists)
echo "Something here.";
else
$sDate--;
I have it check if it exists, if it doesn't, then it reduces $sDate by 1.
$sDate is initially 3 to 31 days less than $Date.
By reducing $sDate by 1, it keeps looking, what if there are no more?
It keeps going until I reach 30 seconds, how can I set a time limit?
I have it on: http://zavaboy.jimbug.org/phptest/blog.php
Go to May 14, 2003 wait 30 seconds for the page to load and you'll see what
I mean.
I don't want it to last 30 seconds and a error, I want 3 seconds max and no
error.
"Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message
news:20030910035008.GN74221@bagend.shire...
> * Thus wrote zavaboy (zavaboy@hotmail.com):
> > How do I set execution time for a for() loop?
> > Like I have a loop stop once it finds 3 things, but what happens when
there
> > are only 2 things? It keeps looking for 30 seconds then shows this
error:
> > Fatal error: Maximum execution time of 30 seconds exceeded in...
> >
> > How can I set it to 3 seconds without a error?
>
> What you explained seems that you're doing something wrong... can
> you provide a small example of what you want to get done?
>
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."