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

One common pitfall when using if-else statements in PHP is forgetting to include an else statement, which can lead to unexpected behavior if none of the conditions are met. To avoid this, always make sure to include an else statement to handle the default case. Additionally, be mindful of the order in which you write your conditions to ensure that the correct block of code is executed.

// Example of using if-else statement with an else block to handle default case
$score = 85;

if ($score >= 90) {
    echo "A";
} elseif ($score >= 80) {
    echo "B";
} elseif ($score >= 70) {
    echo "C";
} else {
    echo "D";
}