 
Use deg2rad( ) and rad2deg( ) on your input and output:
$cosine = rad2deg(cos(deg2rad($degree)));
By definition, 360 degrees is equal to 2 radians, so
it's easy to manually convert between the two
formats. However, these functions use PHP's internal
value of
 radians, so
it's easy to manually convert between the two
formats. However, these functions use PHP's internal
value of  , so you're assured a
high-precision answer. To access this number for other calculations,
use the
constant
M_PI, which is 3.14159265358979323846.
, so you're assured a
high-precision answer. To access this number for other calculations,
use the
constant
M_PI, which is 3.14159265358979323846.
There is no built-in support for gradians. This is considered a feature, not a bug.
Recipe 2.13 for trig basics; documentation on deg2rad( ) at http://www.php.net/deg2rad and rad2deg( ) at http://www.php.net/rad2deg.
 
Copyright © 2003 O'Reilly & Associates. All rights reserved.