This is because of the way PHP works, and the way it converts strings to integers and visa versa. The resolution is to not to compare integers to strings (or to not to compare strings with the number 0).
A resolution to your problem is either to use 7 or -1 as sunday, or use a number for "any".