What are the potential pitfalls of using multiple return statements in PHP functions?

Using multiple return statements in PHP functions can make the code harder to read and maintain, as it can lead to unexpected behavior and make it difficult to track the flow of the function. To solve this issue, it is recommended to have only one return statement at the end of the function, and use variables to store the value that needs to be returned.

function calculateTotal($price, $quantity) {
    $total = $price * $quantity;
    
    if ($total > 100) {
        $discountedTotal = $total * 0.9;
        return $discountedTotal;
    }
    
    return $total;
}