php 默认保几位小数,末尾为0去掉

计算保留几位小数,末位为0舍去

    // 计算 默认保留1位小数
    protected function getSprintf($value,$count,$digit = 1) {
        $num = 0;
        if ($count>0) {
            $num = round($value / $count * 100,$digit);
        }

        return $num;
    }

 

 

 

更多方法:点击产看

posted @ 2018-08-08 11:20  小刁缘  阅读(502)  评论(0编辑  收藏  举报