I have a function that returns 1 on success and a different negative value depending on what went wrong if there was an error. When I check the return value this happens (simplified):
$result = thefunction(); // result is 1
echo $result; // outputs 1
if($result == -1) {
// (some error happened)
echo "result was -1"; // but i still see this
}
Why does PHP not differentiate between negative values?!?