Home >>PHP Math Functions >PHP deg2rad() Function

PHP deg2rad() Function

PHP deg2rad() Function

PHP deg2rad() function is used to convert the given input degree value to an equivalent radian value. It takes only a single parameters $number which is the float value that represents the angle in degrees. It returns a float value that represents the radian equivalent of the given input angle as argument.

Syntax:

  deg2rad($number);

Parameter Values

Parameter Description
number This is a required parameter. This parameter defines the degree to convert.

Here is an example of deg2rad() function in PHP:

<html>
<body>

<?php

echo deg2rad("30")."<br>";
echo deg2rad("70")."<br>";

?>

</body>
</html>
Output:
0.5235987755983
1.221730476396

Here is an another example of deg2rad() function in PHP:

<html>
<body>

<?php

echo deg2rad("0")."<br>";
echo deg2rad("45")."<br>";
echo deg2rad("90")."<br>";
echo deg2rad("180")."<br>";
echo deg2rad("360")."<br>";

?>

</body>
</html>
Output:
0
0.78539816339745
1.5707963267949
3.1415926535898
6.2831853071796