Created
August 2, 2019 18:55
-
-
Save kylekatarnls/0c3146e00c56c0e08fef90b22c3dfbbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
function convertToCelsiusDegrees($degrees, $scale = 'celsius') | |
{ | |
if ($scale == 'fahrenheit') { | |
return $degrees * 1.8 + 32; | |
} | |
return $degrees; | |
} | |
function getWaterState($degrees, $scale = 'celsius') | |
{ | |
$celsiusDegrees = convertToCelsiusDegrees($degrees, $scale); | |
if ($celsiusDegrees < 0) { | |
return 'This is solid ice'; | |
} | |
if ($celsiusDegrees > 100) { | |
return 'This is gaz water'; | |
} | |
return 'This is liquid water'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment