public function getsum($array)
{
$weight = 0;
$count = count($array);
foreach ($array as $key => $value) {
$weight+= $value['value'];
}
return sprintf("%1\$.2f", $weight/$count);
}
public function getsum($array)
{
$weight = 0;
$count = count($array);
foreach ($array as $key => $value) {
$weight+= $value['value'];
}
return sprintf("%1\$.2f", $weight/$count);
}
本文标题:php 平均值和保留两位小数 不足补0
本文链接:https://www.haomeiwen.com/subject/wzqqgqtx.html
网友评论