I have problems to get my percent counter function to get it work with English money format
function calc_proc($price, $savings) {
$old_price = $price + $savings;
return (number_format($savings / ($old_price/100)));
}
because of the commas I’m getting bad values
First of all you don’t have to use strings in financial calculations but if you still have to use, you should replace commas with dots. For example,
Another solution could be setting locale but you’d have issues with dots after that.
In your function it’ll look like this: