Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
Last active August 2, 2019 17:46
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/7b72ec12db68aeb2519913cafd7f5d36 to your computer and use it in GitHub Desktop.
Save kylekatarnls/7b72ec12db68aeb2519913cafd7f5d36 to your computer and use it in GitHub Desktop.
<?php
function getWaterState($degrees, $scale = 'celsius')
{
$celsiusDegrees = $scale == 'fahrenheit'
? $degrees * 1.8 + 32
: $degrees;
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