How to round to nearest Thousand?

前端 未结 8 630
独厮守ぢ
独厮守ぢ 2020-12-06 03:59

How Do I round a number to its nearest thousand?

function round($var) {
    // Round it
}
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 04:39

    Just a small change, may help to round up!

    $x = ceil(220.20 / 1000) * 1000;
    echo $x;
    

提交回复
热议问题