What potential pitfalls could arise when using the if statement in PHP for point calculation?

One potential pitfall when using the if statement for point calculation in PHP is not accounting for all possible conditions, leading to unexpected results or errors. To solve this, ensure that all possible scenarios are considered and that the logic is correctly implemented within the if statement.

// Example of using if statement for point calculation with proper handling of all scenarios

$score = 85;
$points = 0;

if ($score >= 90) {
    $points = 5;
} elseif ($score >= 80) {
    $points = 4;
} elseif ($score >= 70) {
    $points = 3;
} elseif ($score >= 60) {
    $points = 2;
} else {
    $points = 1;
}

echo "Points: " . $points;