What are some best practices for handling nested if-else conditions in PHP code?

Nested if-else conditions can quickly become complex and difficult to read, leading to code that is hard to maintain and debug. To handle nested if-else conditions in PHP code, it is best to use early returns or switch statements to simplify the logic and improve code readability.

// Example of using early returns to handle nested if-else conditions
function handleNestedConditions($condition1, $condition2) {
    if ($condition1) {
        return "Condition 1 is true";
    }
    
    if ($condition2) {
        return "Condition 2 is true";
    }
    
    return "Neither condition is true";
}