PHP: Convert Degrees to Radians and Convert Radians to Degrees

Degrees and radians are different metric means to gauge an angle. They are mutually convertible in PHP. Simply use the PHP degrees to radians function deg2rad() and PHP radians to degrees function rad2deg().

$degrees = 180;
$radians = deg2rad($degrees); // 3.1416
$degrees = rad2deg($radians); // 180

Because trigonometric calculations are usually done in radians, you have to convert the degrees into radians:

$cosine = cos(deg2rad($degrees));
Scroll to Top