Bobulous: Mathematically, no, you can't do that.
Take, for example, this problem:
We know that:
102 = 100
103 = 1000
So you pick a number like 400 and you want to know which power of 10 it's closest too. Of course, by looking at the problem we know that the answer should be 100. (1000-400 is a difference of 600 but 400-100 is only 300 so 400 is much closer to 100 than 1000).
So we must find the power that 10 needs to be raised to to get 400. In other words, 10 ^ X = 400.
echo log(400,10)
or
echo log10(400)
Either one gives you the answer of: 2.6. And if you round 2.6, it goes up to 3. 103 is 1000 which is the wrong answer.
In other words. 102.5 is not half way between 100 and 1000. It's 316.
So the only way I know how to do this problem is to find the log of $start in that $base. Then find the floor($baseThat log) and ceil($baseThat log) and see which one $start is closest to.
I'm sure that there is a mathematical way to improve my algorithm but rounding the power isn't it.