在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

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.