Skip to content

Instantly share code, notes, and snippets.

@ytkhs
Created February 19, 2015 15:06
Show Gist options
  • Save ytkhs/663363edc4512efafefe to your computer and use it in GitHub Desktop.
Save ytkhs/663363edc4512efafefe to your computer and use it in GitHub Desktop.
時計の針の角度(適当版)
<?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