Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
Created August 2, 2019 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylekatarnls/0af82db5485c0991a2dbac3b47d0b7e4 to your computer and use it in GitHub Desktop.
Save kylekatarnls/0af82db5485c0991a2dbac3b47d0b7e4 to your computer and use it in GitHub Desktop.
<?php
function getWaterState($degrees, $scale = 'celsius')
{
if ($scale == 'fahrenheit') {
$celsiusDegrees = $degrees * 1.8 + 32;
} else {
$celsiusDegrees = $degrees;
}
if ($celsiusDegrees < 0) {
return 'This is solid ice';
} elseif ($celsiusDegrees > 100) {
return 'This is gaz water';
} else {
return 'This is liquid water';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment