round() function is used for decimal like 5,5 -> 6 and 5,3 -> 5, and i have problem with milion numbers. For Example : i have number like 35000001, how to make that number to be 3500000 and 69999 to be 70000
$a = round($a / 10) * 10
您可以将10更改为100、1000,以此类推,以便更大程度地取整。
Take a look at the round
function in the PHP manual :
<?php
echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06
?>
Perhaps what you want is:
echo round(1241757, -3); // 1242000
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.