How can the structure of if statements be improved in PHP code to enhance readability and maintainability?

When dealing with complex if statements in PHP code, it is important to improve readability and maintainability by breaking down the conditions into smaller, more manageable parts. This can be achieved by using descriptive variable names, extracting repetitive conditions into separate functions, and utilizing logical operators effectively. By organizing if statements in a clear and structured manner, it becomes easier to understand the code and make future modifications.

// Example of improving if statement structure in PHP code
$condition1 = ($userAge >= 18 && $userAge <= 65);
$condition2 = ($userType == 'admin' || $userType == 'moderator');

if ($condition1 && $condition2) {
    // Code block for when conditions are met
} else {
    // Code block for when conditions are not met
}