The curly braces are not a requirement if there is only one line of code within each condition block (as there is in G-Sun's code).
The problem appears to be the very first condition: if ($d=="1" OR "4")
First, it checks to see if $d is equal to "1". If that is true (if it's a Monday) then the rest of the condition is skipped (because of the OR) and the first include is processed. However if the day isn't Monday, we move onto the next check: "4". The way that PHP evaluates conditions in this case means that "4" actually means that the check returns TRUE! Because of this, whenever the code runs, the first condition will always return TRUE and thus always run the first include.
To fix the problem, you need to amend the condition to be:
if ($d == '1' OR $d == '4')
Note, the important change is to check that $d is equal to '4'. I've used single quotes around the string values because that's better practice but it would work fine with double quotes as you originally used.
|