Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.
Popular code excerpts may be moved to "Code Snippets" by the moderators.
It isn't clear from the function's signature what the parameters are supposed to be for.
Imagine seeing this in your code complete
function convert_data( $number, $unit0, $unit1 )
Maybe its from and to? do I pass in some sort of integer? A string? Which is which? Am I even correct in my assumption. The code itself looks fine I didn't read it in detail. I could probably figure out how to use it if I read it more, but that means the code can be improved - so I think I've looked at it enough to offer my opinion. Looks decent. Could have more descriptive & obvious signature.