PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am working on a postal price calculator and it has all been well and good so far. However. when the weight exceeds 1000g, it costs 89p per 250g or part thereof after.
So far I have this, and this is good because it works out a fractioln of the excess charge and adds it. However, if the $excesschargeportions is anwhere between 0 and 0.999... for instance I need it to round to 1 so the whole 89p will be added.
Thanks for the link. However, I have read through all of this advice and nowhere does it cover rounding up like this. As far as i can see it covers rounding to the nearest something...
i.e.
4.5 to 5
4.6 to 5
4.4 to 4
The thing is I need it to round 0.1 to 1 rather than 0. If I am missing something here please tell me . I cannot think of the degree of accuracy I need to specify to get it to do this because however you look at it 0.1 is close to 0 than 1.
Hmm, don't you mean that it will print 11?? ceil will print the lowest integer greater than or equal to its input. floor will do the greatest integer less than or equal to its input