I am dealing with money and would love to round the numbers to the lowest payable amount on market. Let say I have a calculation resulting in:
- 25,467.56
- 5333.65
- 532
- 60
- 54
In the market the lowest amount payable is 50, so somehow these numbers have to be rounded to the nearest 50 and the result displayed should be:
- 25,450
- 5300
- 500
- 50
- 50
How do accurately and reliably do that? Does PHP offer a built in function to handle that? I tried to Google and get something to read but I got wrong answers so I must be using wrong keyword. Any pointer to the right direction is appreciated!
Note: I use moneyphp for financial calculation and this is a user feature so it is okay to loose that precision.