php实现华氏温度转换摄氏温度

12 / Jan / 2022 PM Note 33

php实现华氏温度转换摄氏温度的方法:通过摄氏温度与华氏温度的换算式“C = 5×(F- 32)/9”来实现转换即可。

php实现华氏温度转换摄氏温度

摄氏温度(C)与华氏温度(F)的换算式是:

C = 5×(F- 32)/9,F = 9×C /5+32

转换示例:

<?php
/**
 * @Author: TIM
 * @Date:   2022-01-12 14:31:12
 * @Email:  61468384@qq.com
 * @Blog:   http://www.tim-blog.com
 * @Desc:   简单即是美 Simple is beautiful...
 * @Last Modified by:   1
 * @Last Modified time: 2022-01-12 15:14:00
 */
//华氏温度οF
$hs=39;
//摄氏温度℃
$ss = (double)(($hs - 32) * 5) / 9;
//转换结果
print_r($ss);
//3.8888888888889

发布评论

© TIM All Rights Reserved sitemap

🌈Theme by TIM