What are common pitfalls when using if-else statements in PHP?

Common pitfalls when using if-else statements in PHP include forgetting to use curly braces for multiple lines of code within the if or else block, using assignment (=) instead of comparison (== or ===) in the condition, and not handling all possible cases explicitly. To avoid these pitfalls, always use curly braces for multiple lines of code, double-check your condition for correct comparison operators, and ensure that you cover all possible scenarios in your if-else logic.

// Example of correct if-else statement usage
$number = 10;

if ($number > 0) {
    echo "Number is positive.";
} elseif ($number < 0) {
    echo "Number is negative.";
} else {
    echo "Number is zero.";
}