What are common pitfalls when using if elseif else loops in PHP?

Common pitfalls when using if elseif else loops in PHP include not properly nesting the conditions, not handling all possible cases, and using too many nested if statements which can make the code harder to read and maintain. To avoid these pitfalls, it's important to clearly define the conditions for each case, use elseif statements instead of nested if statements when possible, and always include a default else case to handle any unexpected scenarios.

// Example of using elseif statements to avoid common pitfalls
$score = 85;

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