You want to use trigonometric functions, such as sine, cosine, and tangent.

PHP supports many trigonometric functions natively: **sin()**, **cos()**, and **tan()**:

1 2 |
// cosine of 2 pi is 1, $result = 1 $result = cos(2 * M_PI); |

You can also use their inverses: **asin()**, **acos()**, and **atan()**:

1 2 |
// arctan of pi/4 is about 0.665773 $result = atan(M_PI / 4); |

These functions assume all angles are in radians, not degrees.

The function **atan2()** takes two variables *$x* and *$y*, and computes atan(*$x/$y*). However, it always returns the correct sign because it uses both parameters when finding the quadrant of the result.

For secant, cosecant, and cotangent, you should manually calculate the reciprocal values of **sin()**, **cos()**, and **tan()**:

1 2 3 4 5 6 7 8 9 |
$n = 0.707; // secant of 0.707 is about 1.53951 $secant = 1 / sin($n); // cosecant of 0.707 is about 1.31524 $cosecant = 1 / cos($n); // cotangent of 0.707 is about 1.17051 $cotangent = 1 / tan($n); |

You can also use hyperbolic functions: **sinh()**,** cosh()**, and **tanh()**, plus, of course, **asinh()**, **acosh()**, and **atanh()**.

The inverse functions, however, arenâ€™t supported on Windows for PHP versions .