deg2rad() function in PHP

PHPProgrammingServer Side Programming

The deg2rad() function converts degree to radian value. It Returns the radian equivalent of the specified degree value.

Syntax

deg2rad(num)

Parameters

  • num − The degree value to be converted to radian.

Return

The deg2rad() function Returns the radian equivalent of the specified degree value.

Example

 Live Demo

<?php
   $degVal = 360;
   $radVal = deg2rad($degVal);
   echo "$degVal degrees converted to $radVal radians!";
?>

Output

360 degrees converted to 6.2831853071796 radians!

Let us see another example −

Example

 Live Demo

<?php
   echo deg2rad("45") . "<br>";
   echo deg2rad("90") . "<br>";
   echo deg2rad("180") . "<br>";
   echo deg2rad("270") . "<br>";
   echo deg2rad("360");
?>

Output

0.78539816339745<br>1.5707963267949<br>3.1415926535898<br>4.7123889803847<br>6.2831853071796
raja
Updated on 26-Jun-2020 09:48:34

Advertisements