What's wrong with this code??
| From: | Beauford | Date: | Tue, 29 Apr 2003 23:08:08 +0000 |
| Subject: | What's wrong with this code?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149613@lists.php.net to get a copy of this message | ||
Hi,
I have the following which gets the month and day:
$mo = date("m");
$dy = date("d");
Then I have the following IF statements which do something based on the
date..
if ($mo == 04 and $dy >= 01 and $dy <= 20) { $wd = "1"; }
if ($mo == 04 and $dy >= 21 and $dy <= 27) { $wd = "2"; }
if ($mo == 04 and $dy >= 28 or $mo == 5 and $dy <= 04) { $wd = "3"; }
if ($mo == 05 and $dy >= 05 and $dy <= 11) { $wd = "4"; }
if ($mo == 05 and $dy >= 12 and $dy <= 18) { $wd = "5"; }
if ($mo == 05 and $dy >= 19 and $dy <= 25) { $wd = "6"; }
if ($mo == 05 and $dy >= 26 or $mo == 06 and $dy <= 01) { $wd = "7"; }
******** Problem lines********
if ($mo == 06 and $dy > 01 and $dy < 09) { $wd = "8"; }
if ($mo == 06 and $dy > 08) { $wd = "9"; }
The first 7 IF statements work fine ($wd gets the right value if the
condition is met), but if I change my date to 06/02 then no matter what I
try, $wd always gets the value of 9 (it should be 8 on this date). It should
not get the value 9 until the 9th of June.
I have checked and $mo and $dy have the proper values.
Am I missing something?
TIA