脚本宝典收集整理的这篇文章主要介绍了PHP数学转换金额,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码:
foreach($numberofballs as $x){ $First = floor($x / 6); $last = $x - ($first * 6); echo $first.'.'.$last; }
让我们分配一个数组进行测试,假设需要为这个循环转换下面的数组
$numberofballs = array(1,2,3,4,5,6); foreach($numberofballs as $x){ $first = floor($x / 6); $last = $x - ($first * 6); echo $first.'.'.$last; } /* notes for 1 IT does it right = 0.1 for 2 it does it right = 0.2 for 3 it does it right = 0.3 for 4 it does it right = 0.4 for 5 it does it right = 0.5 how its supposed to work for 6: for 6 I do not want to get = 1 I would like to get 0.6 and no there is never 0.7 / end notes */
以上是脚本宝典为你收集整理的PHP数学转换金额全部内容,希望文章能够帮你解决PHP数学转换金额所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。