Re: Convert Feet to Metres
| From: | Alan Lord | Date: | Wed, 02 Nov 2005 14:16:08 +0000 |
| Subject: | Re: Convert Feet to Metres | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224949@lists.php.net to get a copy of this message | ||
Shaun wrote:
Hi, I am trying to create a function that will convert metres to feet and vice versa. After searching Google I have found that 1 meters = 3.2808399 feet. However if someone enters 10.5 to mean 10 feet and 5 inches this is not the same as 10 feet and half a foot as there are 12 inches in a foot! Is there a standard conversion for this problem?Make the interface clear (perhaps have separate text boxes for metric or imperial entry) so that they enter Feet and Inches rather than a decimal notation, which is not common anyway. Then calculate the total inches, multiply by 25.4 and divide by 1000. Of course you also need to handle fractions... Most Americans I believe (I'm English) would write 10 5/16" for example. Hope this helps. Alan