What potential issue could arise when using nested if statements in PHP code?

One potential issue when using nested if statements in PHP code is the risk of creating overly complex and difficult-to-read code. To solve this issue, consider refactoring the nested if statements into separate functions or using switch statements instead.

// Example of refactoring nested if statements into separate functions
function checkConditions($condition1, $condition2) {
    if ($condition1) {
        return checkCondition2($condition2);
    }
    return false;
}

function checkCondition2($condition) {
    if ($condition) {
        return true;
    }
    return false;
}

// Usage
$condition1 = true;
$condition2 = true;

if (checkConditions($condition1, $condition2)) {
    // Code to execute if conditions are met
}