<?php
define('TAX_RATE', 0.075);
function calculateTax($price) {
$tax = $price * TAX_RATE;
return $tax;
}
$subtotal = 100;
$tax = calculateTax($subtotal);
$total = $subtotal + $tax;
echo "Subtotal: $subtotal\n";
echo "Tax: $tax\n";
echo "Total: $total\n";
?>Subtotal: 100
Tax: 7.5
Total: 107.5TAX_RATE` is defined outside the `calculateTax()` function using the `define()` function. The `calculateTax()` function takes a price as a parameter and calculates the tax using the `TAX_RATE` constant.calculateTax()` function is then called with a subtotal of 100. The tax is calculated using the `TAX_RATE` constant and added to the subtotal to get the total.echo` statements output the values of the subtotal, tax, and total.