<?php
function round_multiple10_up($num) {
$mod = $num % 10;
if ($mod !== 0)
return (10 - $mod) + $num;
return $num;
}
function round_multiple10_down($num) {
$mod = $num % 10;
if ($mod !== 0)
return $num - $mod;
return $num;
}
$test = 135;
echo round_multiple10_up($test);
echo PHP_EOL;
echo round_multiple10_down($test);
PD9waHAKZnVuY3Rpb24gcm91bmRfbXVsdGlwbGUxMF91cCgkbnVtKSB7CgkkbW9kID0gJG51bSAlIDEwOwoJCglpZiAoJG1vZCAhPT0gMCkKCQlyZXR1cm4gKDEwIC0gJG1vZCkgKyAkbnVtOwoJCglyZXR1cm4gJG51bTsKfQoKZnVuY3Rpb24gcm91bmRfbXVsdGlwbGUxMF9kb3duKCRudW0pIHsKCSRtb2QgPSAkbnVtICUgMTA7CgkKCWlmICgkbW9kICE9PSAwKQoJCXJldHVybiAkbnVtIC0gJG1vZDsKCQkKCXJldHVybiAkbnVtOwp9CgoKJHRlc3QgPSAxMzU7CgplY2hvIHJvdW5kX211bHRpcGxlMTBfdXAoJHRlc3QpOwplY2hvIFBIUF9FT0w7CmVjaG8gcm91bmRfbXVsdGlwbGUxMF9kb3duKCR0ZXN0KTsKCg==