<?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
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.