It was pretty hard to find this bit of PHP code on the web so im posting it here in the vain hope that it will help others. It wil also work for other numbers, just replace the 10s with whatever you wish to round up to, ie. 100 or 1000.
1 2 3 |
$variable = 24; $number = ceil($variable / 10) * 10; // $number = 30 |
Happy Coding
Please follow and like us: