What is the best practice for handling multiple if statements in PHP to ensure all conditions are checked before proceeding to the else statement?

When handling multiple if statements in PHP, it is important to structure the conditions in a way that ensures all conditions are checked before proceeding to the else statement. One way to achieve this is by nesting the if statements inside each other, so that each condition is evaluated sequentially. This ensures that all conditions are checked before the else statement is reached.

if (condition1) {
    if (condition2) {
        if (condition3) {
            // Code to execute if all conditions are met
        } else {
            // Code to execute if condition3 is not met
        }
    } else {
        // Code to execute if condition2 is not met
    }
} else {
    // Code to execute if condition1 is not met
}