This is something weird that started happening recently.
function someFunction() {
return 0;
}
if (someFunction() == 0)
runCode();
elseif (someFunction() == '0')
runOtherCode();
In this situation runCode() will not be called but instead runOtherCode() will be called. Any reason why this is happening?
Edit: Using === fixed this error in some situations. However the other time this issue was present was when returning integer results from a database. For some reason the integers where being converted into strings but adding (int) to the data before returning the data fixed that error.
someFunctionis converted to string, it wouldn't matter. You are comparing using==which does not check the type and thus'0' == 0evaluates to true ('0' === 0however does not).