I want to convert a floating point value of 8 digits after floating point to 2 digits after floating point.
Eg. $ a = 2.200000 ==> 2.20
I use the round php function. The problem with the round - if my number is 2.200000, it will convert the number to 2.2. I want the result to be 2.20
Can anyone suggest a possible way?
Actual code
$price = sprintf ("%.2f", round(($opt->price_value + ($opt->price_value * $this->row->prices[0]->taxes[0]->tax_rate)), 2));
I want it to be like if my floating number is 2.2000000. then he should return me 2.20. but now he brings me back 2.2
source
share