The rad2deg()
function converts radians to degrees.
Radians are calculated as being $degrees
multiplied by the mathematical constant pi, then divided by 180.
PHP rad2deg() Function has the following syntax.
float rad2deg ( float number )
Parameter | Is Required | Description |
---|---|---|
number | Required. | A radian value to convert |
Item | Description |
---|---|
Return Value | The equivalent of number in degrees |
Return Type | Float |
Convert radians to degrees:
<?php
echo rad2deg(pi()) . "\n";
echo rad2deg(pi()/4) . "\n";
$atan_deg = rad2deg(atan(0.46));
echo $atan_deg;
?>
The code above generates the following result.