PHP convert kilometers/hours by nautical miles / hours

Asked

Viewed 678 times

-2

Galley how I convert a km/h value into nautical miles ?

Example: I have a value of 49km/h need to convert this value to nautical miles time "Mn/h" someone knows how to do this function to convert searched in php site no more found

  • 49*0,539957= 26,4578 You can check here http://extraconversion.com/pt/length/metros/metros-miles-nauticas.html

  • $strKm=49; $strConverter=0.539957; $strConverted=$strKm*$strConverter; echo $strConverted;

  • In case not meters but speed I’m wanting is the same thing ?

  • The above are PHP variables so you can work with PHP. Units of measures are understood.

2 answers

0


Whereas 1 nautical mile amounts to 1,852 kilometer, to convert Km/h in Mn/h the following calculation is sufficient:

Divide the value in Km for 1,852:

<?php
function kmh_to_mnh($v){

   $mnH = $v / 1.852;

   return $mnH.'mn/h';
}

echo kmh_to_mnh(50); // 50Km/h -> 26.99784017278mn/h
?>

-1

Good afternoon, would not just multiply the value by 0.5396118?

  • Just that ? I’ll try and tell you if it worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.