--- Gnik <[EMAIL PROTECTED]> wrote:
> I isolated the problem to be in the 'strtotime' function. Here is a
> test I ran - when it runs, after getting to 2003-10-26, it scrolls
> incessently:
> 
> ----BEGIN CODE------
> <?php
> $stop= "2003-12-27" ;
> $start= "2003-01-01" ;
> While ($start <> $stop) {
>     echo "<BR> Date: " . $start ;
>     $start = date('Y-m-d', strtotime($start) + 86400);
> }
> ?>
> ----END CODE------

Your approach makes me wonder why you are bothering to convert between
timestamps and formatted dates so many times. It makes much more sense to
use timestamps for conditionals and math, and use date() only in your echo
statement.

As for your particular error, I'm sure you could easily find it with just
a few minutes of debugging. For example, output the value of $start and
$stop at the beginning and very end of each loop.

Also, you might want to use != for not equal. From the manual
(http://www.php.net/manual/en/language.expressions.php):

PHP supports > (bigger than), >= (bigger than or equal to), == (equal), !=
(not equal), < (smaller than) and <= (smaller than or equal to). These
expressions are most commonly used inside conditional execution, such as
if  statements.

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
     Coming mid-2004
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

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

Reply via email to