What best practices should be followed when using IF-ELSE and ELSEIF statements in PHP to avoid logical errors in code execution?

When using IF-ELSE and ELSEIF statements in PHP, it is important to ensure that the conditions are mutually exclusive to avoid logical errors in code execution. This means that each condition should be distinct and not overlap with others. Additionally, it is good practice to use ELSEIF statements instead of nested IF-ELSE statements for better readability and maintainability of the code.

// Example of using ELSEIF statements to avoid logical errors
$score = 85;

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