PHP program to enter the temperature in Fahrenheit and convert it to Celsius
ADVERTISEMENTS
PHP program to enter the temperature in Fahrenheit and convert it to Celsius.
There are you will learn how to convert the temperature in Fahrenheit and convert it to Celsius in PHP language.
Formula:
C = (F - 32) * 5/9
Where:
F = fahrenheit
C = celsius
Let us understand this example through the PHP program:
<?php
// PHP program to convert the temperature from degree fahrenheit to celsius
$c = NULL;
$f = 7;
// c = celsius
// f = fahrenheit
// Conversion of fahrenheit to celsius
$c = (float)(($f - 32) * 5 / 9);
// Output
printf("\n" . $f . " Fahrenheit = " . $c . " Celsius\n");
?>
Output:
7 Fahrenheit = -13.888888888889 Celsius