You could do it as a one-liner like so:
function nearestMultiple($num, $mult) {
return (($num % $mult) < floor($mult / 2) ? ($num - ($num % $mult)) : ($num + ($mult - ($num % $mult))));
}
Note that the function only works for integers though it doesn't include any error checking to verify that this condition is satisfied.