rad2deg(): Convert Radian to Degree

Convert radians to degrees

rad2deg() converts an angle measured in radians to degrees, which is often easier to display to users.

$radians = pi() / 2;
echo rad2deg($radians); // 90

Start with this current pattern. The examples below are retained for additional variations, output and reference.

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



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer