Latest web development tutorials

PHP deg2rad () function

PHP Math Reference PHP Math Reference

Examples

The degrees to radians:

<?php
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+


Examples s

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.";
?>

Running instance »


PHP Math Reference PHP Math Reference