Skip to content

Instantly share code, notes, and snippets.

@FreshLondon
Last active March 16, 2019 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FreshLondon/9f95ce73867df7a001c12583cbbfe414 to your computer and use it in GitHub Desktop.
Save FreshLondon/9f95ce73867df7a001c12583cbbfe414 to your computer and use it in GitHub Desktop.
Function: metres to feet and inches
<? function metersToFeetInches($meters, $echo = true) {
$m = $meters;
$valInFeet = $m * 3.2808399;
$valFeet = (int)$valInFeet;
$valInches = round(($valInFeet - $valFeet) * 12);
$data = $valFeet."&prime;".$valInches."&Prime;";
if ($echo == true) {
echo $data;
} else {
return $data;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment