Jump to content

format number into feet and inches


johnrb87

Recommended Posts

Yes, it IS possible

 

I'm going to assume you want to know HOW it's done.

 

<?php

$metres = 5.25;

$feet = floor( $metres / 0.3048 );
$inches = ($metres - 0.3048*$feet) / 0.0254;

echo "$metres metres is $feet feet and ".round($inches,2)." inches";

?>

 

Quick n simple way. Based on 1 metre = 0.3048 feet, and 1 metre = 0.0254 inches.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.