At 01:08 30.04.2003, Beauford said:
--------------------[snip]--------------------
>if ($mo == 06 and $dy > 01 and $dy < 09) { $wd = "8"; }
>if ($mo == 06 and $dy > 08) { $wd = "9"; }
--------------------[snip]-------------------- 

The problem is your notation. If you had written

    if ($mo == 6 and $dy > 1 and $dy < 9) { $wd = "8"; }
    if ($mo == 6 and $dy > 8) { $wd = "9"; }

your logic would still look a bit clumsy but work as you intend.

Why? Prefixing a number with a zero makes the intepreter believe you're
using octal numbers. Oczal numbers range from 00 to 07, the decimal number
8 would be 010 in octal notation. Your code, translated in decimal for
better understanding, is seen by the compiler as

    if ($mo == 6 and $dy > 1 and $dy < 2) { $wd = "8"; }
    if ($mo == 6 and $dy > 0) { $wd = "9"; }

(08 => decimal 0, 09 => decimal 1). In this case your last statement will
trigger for _any_ day in June.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



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

Reply via email to