Skip to content

Instantly share code, notes, and snippets.

@otanodesignco
Created June 20, 2013 17:31
Show Gist options
  • Save otanodesignco/5824819 to your computer and use it in GitHub Desktop.
Save otanodesignco/5824819 to your computer and use it in GitHub Desktop.
Calculate the Hypotenuse of a Triangle give the A & B sides.
<?php
function hypotenuse($A, $B)
{
if(is_numeric($A) && is_numeric($B))
{
return sqrt(($A * $A) + ($B * $B));
}
else
{
return 0;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment