Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
Created August 2, 2019 18:55
Show Gist options
  • Save kylekatarnls/0c3146e00c56c0e08fef90b22c3dfbbd to your computer and use it in GitHub Desktop.
Save kylekatarnls/0c3146e00c56c0e08fef90b22c3dfbbd to your computer and use it in GitHub Desktop.
<?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