PHP deg2rad () function
Examples
The degrees to radians:
<?php
echo deg2rad("45") . "<br>";
echo deg2rad("90") . "<br>";
echo deg2rad("360");
?>
echo deg2rad("45") . "<br>";
echo deg2rad("90") . "<br>";
echo deg2rad("360");
?>
Running instance »
Definition and Usage
deg2rad () function to convert the value of the angle in radians.
Tip: If you need to convert the angle in radians value, see rad2deg () function.
grammar
deg2rad( number );
参数 | 描述 |
---|---|
number | 必需。规定要转换的角度。 |
technical details
return value: | number corresponding arc. |
---|---|
Return type: | Float |
PHP version: | 4+ |
More examples
Example 1
The angle is converted to its corresponding radian:
<?php
$deg = 180;
$rad = deg2rad($deg);
echo "$deg degrees is equal to $rad radians.";
?>
$deg = 180;
$rad = deg2rad($deg);
echo "$deg degrees is equal to $rad radians.";
?>
Running instance »
PHP Math Reference