This has to be a simple error, but I can't find it. I'm hoping a second set of eyes can help.
Here's the script:
// defined earlier in a separately included script
$default = "charlie";
$lastmodified = "20140224111423";
// the script in question
$approved = false;
$sttMod = strtotime($lastmodified);
if ($default == "alpha") {
if ($sttMod >= strtotime("-30 days")) $approved = true;
}
else if ($default == "beta" || $default == "charlie") {
if ($sttMod >= strtotime("-90 days")) $approved = true;
}
else $approved = true;
echo $approved;
// returns true, which it should
But, if I remove the "unnecessary" { }, like so:
if ($default == "alpha")
if ($sttMod >= strtotime("-30 days")) $approved = true;
else if ($default == "beta" || $default == "charlie")
if ($sttMod >= strtotime("-90 days")) $approved = true;
else $approved = true;
// returns false
I'm getting "false" (or, at least, it's printing ""), which shouldn't be correct. This should still match the else if statement, and strtotime() is >= 90 days, so it should return true.
Where am I messing up?