php中如何向上取整以5为界?
public function test(){
$number = 52093;
var_dump( $this->roundNumberVariant( ( int ) $number ) );
}
private function roundNumberVariant( $number ){
//注意:因涉及乘除运算,为了避免知普通计算导致的不精确问题,直接使用BC库函数
return ( int ) bcmul( ceil( bcdiv( $number , 5000 , 4 ) ) , 5000 );
}