Angle measurement is one of the foundational elements of geometry and trigonometry, and the two most commonly used measurement methods are degrees and radians. Because of its simplicity, many prefer to use a degree over Radian. Some of the reasons that make degrees more preferable:
- The degrees may not be very effective at calculating derivatives or complex relationships, but they are easy to understand and visualize.
- At the time as Radian is actually a ratio, Degree is regarded as a unit of rotational displacement, where total rotation is equivalent to 360 Degrees. Because of this simplicity, students learn and are much more familiar with degrees than radians.
So, in some cases, we may need to convert radians to degrees, and this is where the rad2deg ( ).Syntax:
float rad2deg ($value) Parameters : The function takes a single parameter, $value, which is of type float, representing the angle in radians.Return type : This function returns a floating point value representing the equivalent in degrees given angle value $.Examples:
Input: $value = M_PI_4; Output: 45 Input: $value = M_PI_2; Output: 90 Input: $value = M_PI; Output: 180 The following program illustrates how rad2deg() works in PHP:
// PHP code to illustrate rad2deg()
< = 8;
* = 2,
/ = 2)
! = 1)
’ = ’
. rad2deg (
’ pi = ’
. rad2deg ( Output:
pi = 180 pi / 2 = 90 pi / 4 = 45 pi / 8 = 22.5 Important points to pay attention to :
- It calculates the degree equivalent of an angle in radians.
- The method is analogous to rad2deg().
- This method gives very accurate results, but is not very time efficient.
http://php.net/manual/ en / function.rad2deg.php