What I'm trying to do seems rather simple, but I can't get it to work with the php.net documentation..
Numbers should always be rounded to "tens"
So:
1 -> 10
7 -> 10
12 -> 20
18 -> 20
23 -> 30
35 -> 40
Something like this should work:
$rounded_num = round($orig_num / 10) * 10;
Your should use round() function. But if you want manual way, you can use something like that:
$number = 189;
$length = strlen((string)$number);
$div = '1';
for ($i=0;$i<$length-1;$i++){
$div .= '0';
}
$result = (int)$div*(ceil($number/$div));
$result = 200