<?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. <?php
echo rad2deg(2 * M_PI); // Output: 360
?>
<?php
echo rad2deg(-M_PI); // Output: -180
?>
<?php
echo rad2deg(0.1); // Output: 5.7295779513
?>
<?php
echo rad2deg(M_PI); // Output: 180
?>
<?php
$degrees = 45;
$radians = deg2rad($degrees);
echo rad2deg($radians); // Output: 45
?>
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.