F1:四舍五入保留两位小数,不补齐0

echo round($num,2);

F2:不四舍五入保留两位小数,不补齐0

echo floor($num*10000)/100);

 

F3:保留两位小数,自动补齐0,直接截取

echo sprintf(“%.2f”, $num);

F4:四舍五入,保留两位小数,自动补齐0

sprintf(“%.2f”, round($n,2));

F5:不四舍五入,保留两位小数,自动补齐0

echo sprintf(“%.2f”,floor($num*10000)/100);

作者 admin

百度广告效果展示