function fCeil($val,$pressision=2){
$p = pow(10,$pressision);
$val = $val*$p;
$val = ceil($val);
return $val /$p;
}
echo fCeil(1.2778954, 1);
echo "<br>";
echo fCeil(1.2778954, 2);
echo "<br>";
echo fCeil(1.2778954, 3);
echo "<br>";
echo fCeil(1.2778954, 4);
echo "<br>";
echo fCeil(1.2778954, 5);
輸出:
1.3
1.28
1.278
1.2779
1.2779
全站熱搜
留言列表