duancai9010 2016-08-30 08:27
浏览 18

在Php中需要一个模数公式[关闭]

I am creating a fee calculator and fee is calculated on based of capital. So I want a formula in php.

if capital is <=1000000 then fee is 1000 if capital is 1100000 - 2000000 fee is 2000 if capital is 2100000 - 3000000 fee is 3000 if capital is 3100000 - 4000000 fee is 4000 if capital is 4100000 - 5000000 fee is 5000 and so on so what i want is i want a formula that will give me a fee of 1000 per 10 Lakh

  • 写回答

1条回答 默认 最新

  • doufei1988 2016-08-30 08:30
    关注

    Assuming your variable is called $capital, then this should work:

    print ((int)(1000*ceil($capital/1000000)));
    

    It divides by 1000000, rounds up, then multiplies by 1000.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题