我查看了 php round 函数,但我认为它不能满足我的需要,我不想四舍五入到小数位我希望执行以下操作:
$variable1 = 200000000 into 200
$variable2 = 20000000 into 20
$variable3 = 2000000 into 2
$variable4 = 200000 into 0.2
有人可以帮助我吗?
我应该补充一点,我不知道变量是什么,所以它可能是 20000000 一次,下一次是 380000000
将数字除以1000000
。
$num /= 1000000;
$millionDivide = 1000000;
echo $variable1 = 200000000/$millionDivide;
echo $variable2 = 20000000/$millionDivide;
echo $variable3 = 2000000/$millionDivide;
echo $variable4 = 200000/$millionDivide;