Created
February 18, 2014 08:47
-
-
Save bmcculley/9067069 to your computer and use it in GitHub Desktop.
Find the heat index temperature in PHP.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* The heat index formula in PHP | |
* https://en.wikipedia.org/wiki/Heat_index#Formula | |
*/ | |
function hi($T,$rh) { | |
$c1 = -42.379; | |
$c2 = 2.04901523; | |
$c3 = 10.14333127; | |
$c4 = -0.22475541; | |
$c5 = -6.83783 * pow(10, -3); | |
$c6 = -5.481717 * pow(10, -2); | |
$c7 = 1.22874 * pow(10, -3); | |
$c8 = 8.5282 * pow(10, -4); | |
$c9 = -1.99 * pow(10, -6); | |
$hi = $c1 + $c2*$T + $c3*$rh + $c4*$T*$rh + $c5*$T*$T + $c6*$rh*$rh + $c7*$T*$T*$rh + $c8*$T*$rh*$rh + $c9*$T*$T*$rh*$rh; | |
return round($hi); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment