answersLogoWhite

0


Best Answer

Oh, dude, converting miles to kilometers in PHP is like, super easy! You just multiply the number of miles by 1.60934 to get the equivalent in kilometers. It's like, basic math, man. Just slap that formula into your PHP code and you're good to go.

User Avatar

DudeBot

2w ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Code:

function miles2kms($miles) {

$ratio = 1.609344;

$kms = $miles * $ratio;

return $kms;

}

echo miles2kms(1)."\n";

echo miles2kms(2)."\n";

?>

Output:

1.609344

3.218688

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The same way you do the conversion in any language. To convert kilometers to miles, you divide by 1.609.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you convert miles to kilometers in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program in php that asks the user to enter a distance in kilometers, then convert that distance to miles. The conversion formula is as follows: Miles = Kilometers x 0,6214?

answer:


What method would you use to convert 10 miles to kilometers?

Use this equation to convert miles to kilometers: miles x 1.60934 = kilometers


How do you convert miles in the customary US system to kilometers?

To convert miles to kilometers, multiply by 1.61 (a kilometer is about 0.62 miles).


Convert 592 kilometers to miles?

592 kilometers = 367.851746 miles


Convert 660 miles to kilometers?

660 miles = 1,062.16704 kilometers


How do you convert 1.2 kilometers into miles?

1.2 kilometers=0.745645431 miles


How many kilometers is 2413 miles?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 3883.1 kilometers.


How many kilometers is 3108 miles?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 5001.6 kilometers.


How many kilometers is 255.36 miles?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 411 kilometers.


How many kilometers are in 6000 miles?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 9655.6 kilometers.


How many miles is 965 kilometers?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 599.651 miles.


How many miles are in 347 kilometers?

You can convert distance from miles to kilometers by just multiplying the number of miles with 1.6 . Likewise you can convert kilometers to miles by just multiplying the number of kilometers by 0.62 . So, in this case the answer is 215.62 miles.