I have a function that takes an input, where $input
comes from a MySQL database and is either an integer, a string, or null value, and returns one of three strings based on the following conditions:
If it is an int that's equal to 0, return something
Elseif it is an empty string, return something else
Else return something else
My code looks like this:
if ($input == "") {
return "case1";
}
elseif ($input == "0") {
return "case2";
}
else {
return "case3";
}
After echoing each input and comparing the output, it doesn't seem to work. Any ideas? I've tried using every combination of "0" and 0, == and ===.
In testing, whole numbers and strings work, an so do empty strings. But an input of integer 0 does returns case3.