Reputation: 15950
I am getting a max value through value. It can be any digit (whole number). I want it to take to next tenth-value, using PHP
Example:
If value is 66, then I need value 70
If value is 6, then I need value 10
If value is 98, then I need value 100
Upvotes: 0
Views: 600
Reputation: 655269
This is an arithmetic problem:
y = ceil(x / 10) * 10
If you’re looking just for the nearest decade, use round
instead.
Upvotes: 6