rad2deg(): Convert Radian to Degree
<?Php
echo rad2deg(0); // Output is 0
echo "<br>";
echo rad2deg(PI()); // Output 180
echo "<br>";
echo rad2deg(PI()/2); // Output is 90
echo "<br>";
echo rad2deg(PI()/3); // Output is 60
?>
Syntax
rad2deg(X);
X is the number representing angular value in radian. Output is in degree.
Example 1: Converting a Full Circle (2π Radians)
<?php
echo rad2deg(2 * M_PI); // Output: 360
?>
Example 2: Converting Negative Radians to Degrees
<?php
echo rad2deg(-M_PI); // Output: -180
?>
Example 3: Converting Small Values
<?php
echo rad2deg(0.1); // Output: 5.7295779513
?>
Example 4: Converting Half Circle
<?php
echo rad2deg(M_PI); // Output: 180
?>
Example 5: Degrees to Radians and Back
<?php
$degrees = 45;
$radians = deg2rad($degrees);
echo rad2deg($radians); // Output: 45
?>
Math Constant PI()
Plotting of SIN & COS curves by using PHP GD function with deg2rad()
← Math Functions
deg2rad() function →
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com