What are common pitfalls when using if statements in PHP functions, as seen in the provided code snippet?

One common pitfall when using if statements in PHP functions is not properly handling all possible cases, leading to unexpected behavior or errors. To solve this, make sure to include conditions for all possible scenarios and provide appropriate handling for each case.

// Example of a common pitfall in using if statements in PHP functions
function checkNumber($num) {
    if ($num > 0) {
        return "Positive";
    } else if ($num < 0) {
        return "Negative";
    }
}

// Fixing the issue by adding a condition for zero
function checkNumberFixed($num) {
    if ($num > 0) {
        return "Positive";
    } else if ($num < 0) {
        return "Negative";
    } else {
        return "Zero";
    }
}