TechniquePHP has a plethora of trigonometry functions, including acos() , asin() , atan() , atan2() , cos() , sin() , and tan() : <?php // $num will be the arc cosine of .5 // (the angle that yields a cos of .5) $num = acos (.5); // $num will be the arc sine of .5 // (the angle that yields a sine of .5) $num = asin (.5); // $num will be the arc tangent of .5 // (the angle that yields a tan of .5) $num = atan (.5); // $num is the arc tangent of .5 and .67 $num = atan2 (.5, .67); // $num is the sin of P $num = sin (M_PI); // $num is the cosine of P $num = cos (M_PI); // $num is the tangent of P $num = tan (M_PI); ?> CommentsThe atan2() function is the same as atan((.5)/(.67)) , except that the quadrant of the result is accurate (and, therefore, so is the sign). |