Home > Article > Backend Development > How to convert Fahrenheit temperature to Celsius temperature in PHP
php method to convert Fahrenheit temperature to Celsius temperature: 1. Create a PHP sample file; 2. Implement it through the conversion formula between Celsius temperature and Fahrenheit temperature "C = 5×(F-32)/9" Just convert.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
How to convert Fahrenheit temperature to Celsius temperature with php ?
The conversion formula between Celsius temperature (C) and Fahrenheit temperature (F) is:
C = 5×(F- 32)/9,F = 9×C /5+32
php conversion example is as follows:
<?php //华氏温度οF $hs=39; //摄氏温度℃ $ss = (double)(($hs - 32) * 5) / 9; //转换结果 print_r($ss); //3.8888888888889 ?>
Recommended study: "PHP video tutorial》
The above is the detailed content of How to convert Fahrenheit temperature to Celsius temperature in PHP. For more information, please follow other related articles on the PHP Chinese website!