Home > Backend Development > PHP Problem > How to convert Fahrenheit temperature to Celsius temperature in PHP

How to convert Fahrenheit temperature to Celsius temperature in PHP

藏色散人
Release: 2023-03-14 19:48:02
Original
3470 people have browsed it

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.

How to convert Fahrenheit temperature to Celsius temperature in PHP

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
Copy after login

php conversion example is as follows:

<?php
 
//华氏温度οF
$hs=39;
 
//摄氏温度℃
$ss = (double)(($hs - 32) * 5) / 9;
 
//转换结果
print_r($ss);
//3.8888888888889
 
 
?>
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template