Hi guys,
I’ve been trying to modify a script I am using so that instead of just displaying prices, it will also display the discount as a percentage.
Example:
X = $300 - Y = $200 So the equation (((X - Y) / X) * 100) = Z should return 33.33 as the value of Z, which works perfectly if carried out manually.
However I tried putting this into php and all it keeps returning is “0” even though the other variables meant it should have returned values of 15 and above…?
This is the code I used, but I can’t spot the error…
[php]$discount = ((($listprice - $price) / $listprice) * 100);
$content = str_replace("{discount}", $discount, $content);[/php]
If anybody can offer a little advice I’d be very grateful.
Cheers Taffy