What are some best practices for implementing conditional statements in PHP to avoid unnecessary complexity?

When implementing conditional statements in PHP, it's important to keep the code clean and avoid unnecessary complexity. One way to achieve this is by using early returns to handle edge cases or conditions that require immediate action, rather than nesting multiple if-else statements. This approach can help improve code readability and maintainability.

// Example of using early returns to simplify conditional statements
function calculatePrice($quantity) {
    if ($quantity <= 0) {
        return 0;
    }

    $price = 10;
    
    if ($quantity > 10) {
        $price *= 0.9; // apply a 10% discount for quantities over 10
    }

    return $price * $quantity;
}