Answer the question
In order to leave comments, you need to log in
How to round up the price correctly?
I import the price from the price list using phpExcel
In a loop, getting the price of each column:
$price = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(4, $i)->getValue();
543.8099999999999
Answer the question
In order to leave comments, you need to log in
Alternatively, round to two decimal places:
$n = '543.8099999999999';
echo(round($n*100)/100);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question