14. PHP Program to convert temperature in Fahrenheit into Celsius.
How does this program work?
- In this program you will learn about how to convert temperature of city in Fahrenheit into Celsius using PHP.
- In this program we can easily convert temperature in fahrenheit into celsius by using given formula.
- This program perform mathematical calculation and display the result.
Here is the code
<html>
<head>
<title>PHP Program To convert Temperature in Fahrenheit into Celsius</title>
</head>
<body>
<form method="post">
<table border="0">
<tr>
<td> <input type="text" name="num" value="" placeholder="Enter temperature in fahrenheit"/> </td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="Submit"/> </td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit']))
{
$f = $_POST['num'];
$a = $f-32;
$g = (5*$a)/9;
echo " Temperature in degree celsius = ".$g;
return 0;
}
?>
</body>
</html>