I am attempting to display the results of strings carried across a redirect, everything is working fine except that the result gives more than 2 decimal places, and I cannot figure out how to keep it to only the 2 decimals.
As you can see I am calculating the Order Total after adding VAT, I already have the item totals $price1 , $price2 and the VAT calculates fine but produces more than 2 decimal places.
// the calculation
<?
$subtotal = $price1+$price2;
$vat = $subtotal*.175;
$total = $vat+$subtotal;
?>
//the output
<?=$subtotal?>
<?=$vat?>
<?=$total?>
I am fairly new to PHP and enjoy solving problems, but this buggers got me beat...