小数转换百分比保留2位小数

$todaySucRate = round($row['CNT']/$row['TOTAL_CNT'],8);
// 支付成功率 保留2位小数
$sucRate = sprintf("%2.2f%%", $todaySucRate * 100);
// 支付成功率 保留4位小数
$sucRate = sprintf("%2.4f%%", $todaySucRate * 100);
发布了45 篇原创文章 · 获赞 10 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/sosemseo/article/details/105725959