Code: Select all
<?php
preg_match('/\d+\.?\d*/', $price, $priceInt);
preg_match('/\d+\.?\d*/', $special, $specialInt);
?>
<h3><?php echo (($priceInt[0]-$specialInt[0])/$priceInt[0])*100 ?>% Discount</h3>
My question is: How do I show the percentage as a whole number only?
eg. 12.34567890% = 12%
Thank you.