您好,我如何将以下内容四舍五入到小数点后两位。
echo
"<div class='quote-results-result'>ex VAT £" .
((($_POST['qtylitres'] * $price ['Price']) + $fuelmargin['margin']) / 1.2) .
"</div>"
我需要四舍五入一个 php 新手的价格位。
最佳答案
像这样使用 number_format 函数:
$number = 1234.56789
$new_number = number_format($number, 2, '.', '');
echo $new_number;
Output: 1234.57
关于php - php中的整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11469814/