What are the potential pitfalls of including variables in a function in PHP?

Including variables in a function in PHP can lead to potential issues such as variable scope conflicts or unintended variable modifications. To avoid these pitfalls, it is recommended to pass variables as arguments to the function instead of relying on global variables or variables outside the function's scope.

// Example of passing variables as arguments to a function
function calculateTotal($price, $quantity) {
    return $price * $quantity;
}

$price = 10;
$quantity = 5;
$total = calculateTotal($price, $quantity);
echo "Total: $total";