php保留两位小数并且四舍五入
$num = 5566.56831;
echo sprintf("%.2f", $num);
php保留两位小数并且不四舍五入
$num = 5566.56831;
echo sprintf("%.2f",substr(sprintf("%.3f", $num), 0, -2));
php进一法取整
echo ceil(4.2); // 5
echo ceil(9.999); //
php舍去法取整
echo floor(4.2); // 4
echo floor(9.999); //