if I wait untill $sDate is zero, it'll be in 2000.
I have $Date based on the current date, like to day is: 03252
03 is the year 252 is the day of the year.

"Mike Ford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 10 September 2003 11:26, zavaboy contributed these pearls of wisdom:
>
> > // 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?
>
> No need to set a time limit for this -- just set a limit on how far $sDate
> can be decremented.  Presumably only positive values are invalid, so just
> stop the loop when $sDate goes <=0 -- either
>
>     for ($i = $Date; $i >= $sDate && $sDate > 0; $i--)
>
> or something like:
>
>     for ($i = $Date; $i >= $sDate; $i--):
>
>       if ($Exists):
>         echo "Something here.";
>       else:
>         $sDate--;
>         if ($sDate<=0):
>           // do any necessary tidying up here -- e.g. set a
>           // flag to say the loop was exited via the side door
>           break;   // escape from the for loop
>         endif;
>       endif;
>
>     endfor;
>     // break escapes to here
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to