Skip to content

Instantly share code, notes, and snippets.

@nellytadi
Created June 8, 2019 15:19
Show Gist options
  • Save nellytadi/42d1a49b63634802982826e2235aac97 to your computer and use it in GitHub Desktop.
Save nellytadi/42d1a49b63634802982826e2235aac97 to your computer and use it in GitHub Desktop.
<?php
public function degrees($hour, $min)
{
$degree = $hour*30 + $min *6;
if ($degree>360){
$result= $degree - 360;
}
elseif ($degree< 360) {
$result = $degree;
}
echo $result.' degrees';
}
?>
@nellytadi
Copy link
Author

`<?php
//practical solution
$hour = 2;
$min = 45;
$degree = $hour * 30 + $min * 6;
if ($degree>360){
$result= $degree - 360;
echo $result.' degrees';
}
elseif ($degree< 360) {
$result = $degree;
echo $result.' degrees';
}

?>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment