lindsaycb
07-31-2008, 07:56 PM
You would think it would be simple
So then why doesn't this work?
I've tried these two:
$currentMonth = date("m");
$semester = "";
if ($currentMonth >= 01 && $currentMonth <= 05) {
$semester = "Spring";
} elseif ($currentMonth >= 06 && $currentMonth <= 08) {
$semester = "Summer";
} else {
$semester = "Winter"; }
$currentMonth = date("m");
$semester = "0";
if ($currentMonth > 00 && $currentMonth < 06) {
$semester = "Spring";
} elseif ($currentMonth > 05 && $currentMonth < 09) {
$semester = "Summer";
} else {
$semester = "Winter"; }
It will give me either Winter using the && operator and Spring if I use the ||. But neither will give me Summer, which is what it should be since it's 07.
What do you think? Is it possible to get this to work?
So then why doesn't this work?
I've tried these two:
$currentMonth = date("m");
$semester = "";
if ($currentMonth >= 01 && $currentMonth <= 05) {
$semester = "Spring";
} elseif ($currentMonth >= 06 && $currentMonth <= 08) {
$semester = "Summer";
} else {
$semester = "Winter"; }
$currentMonth = date("m");
$semester = "0";
if ($currentMonth > 00 && $currentMonth < 06) {
$semester = "Spring";
} elseif ($currentMonth > 05 && $currentMonth < 09) {
$semester = "Summer";
} else {
$semester = "Winter"; }
It will give me either Winter using the && operator and Spring if I use the ||. But neither will give me Summer, which is what it should be since it's 07.
What do you think? Is it possible to get this to work?