1.8.php

You are purchasing 30 widget(s) at a price of 119.95. The total is €3,778.43

# Script 1.8
//Set the variables
$quantity = 30; //Buying 30 widgets
$price = 119.95;
$taxrate = .05; // 5% sales tax

//Calculate the total
$total = $quantity * $price;
$total = $total + ($total * $taxrate);
//Add tax

//Format the total
$total = number_format($total, 2);

//Print the result
echo '<p>You are purchasing <b>' .
$quantity . '</b> widget(s) at a price of ' .
$price . '. The total is €' . $total;