PHP – Degrees / Radians Conversions

The given PHP function convert degrees to radians or radians to degrees.

Code Example:
<?php
//degrees to radians function
function DegToRad($degrees) {
 return $degrees * 3.14 / 180;
}
//radians to degrees conversion
function RadToDeg($radians) {
 return $radians * 180 / 3.14;
}

// Example
echo DegToRad(90);
echo "<br />";
echo RadToDeg(0.707);
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *