I found a great function to convert measurements from centimeters to feet/inches, however when I plug a particular number $cm = 182 I get result of 5' 12" instead of expected 6'.
I can't seem to be able to figure out where the problem is. Here's the function code:
// Cm to ft conversion.
// By Igor Slyusar, http://www.slyusar.com
// Usage: list($feet, $inches) = cmtoft($cm);
function cmtoft() {
$inches = @func_get_arg(0)*0.3937;
$feet = intval($inches/12);
$inches = round($inches - ($feet*12), 0);
return array($feet, $inches);
}
list($feet, $inches) = cmtoft($cm);