<?php $a = 1.1; $b = 3.9; //取整数部分 echo floor($a); // 1 echo floor($b); // 3 // 进一取整 echo ceil($a); // 2 echo ceil($b); // 4 // 四舍五入 echo round($a); // 1 echo round($b); // 4 ?>
The above has introduced PHP floating point number rounding, rounding, and rounding, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.