2.12. Calculating Trigonometric Functions
$cos = cos(2.1232);
You can also use their inverses: asin( ), acos( ), and atan( ):
$atan = atan(1.2);
These functions assume their arguments are in radians, not degrees. (See Recipe 2.13 if this is a problem.)
$n = .707; $secant = 1 / sin($n); $cosecant = 1 / cos($n); $cotangent = 1 / tan($n);
Starting in PHP 4.1, you can also use hyperbolic functions: sinh( ), cosh( ), and tanh( ), plus, of course, asin( ), cosh( ), and atanh( ). The inverse functions, however, aren't supported on Windows.
2.12.4. See Also
Recipe 2.13 for how to perform trig operations in degrees, not radians; documentation on sin( ) at http://www.php.net/sin, cos( ) at http://www.php.net/cos, tan( ) at http://www.php.net/tan, asin( ) at http://www.php.net/asin, acos( ) at http://www.php.net/acos, atan( ) at http://www.php.net/atan, and atan2( ) at http://www.php.net/atan2.
Copyright © 2003 O'Reilly & Associates. All rights reserved.