TechniqueConvert between degrees and radians: <?php $num1 = 90; $num2 = 3.14; $rad = deg2rad ($num1); $deg = rad2deg ($num2); print "The value of $num1 degrees in radians is $rad\n"; print "and the value of $num2 radians is $deg degrees"; ?> CommentsThe deg2rad() and rad2deg() functions can be used to convert a number from degrees to radians and back again. This can be very useful if you want to find the cosine of a number that is in degrees. You can use the deg2rad() function to convert the number and then use the cos() function on the result: <?php $cos_60 = cos (deg2rad (60)); ?> |