Created
February 19, 2015 15:06
-
-
Save ytkhs/663363edc4512efafefe 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 clockAngle($hour, $min) | |
{ | |
$longAngle = $min*6; | |
$shortAngle = 30*($hour + ($min/60)); | |
return abs($longAngle - $shortAngle); | |
} | |
var_dump(clockAngle(3,0)); | |
var_dump(clockAngle(9,30)); | |
var_dump(clockAngle(1,59)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment