Example 1 — Common Angles
Convert well-known radian values to degrees.
<?php
echo rad2deg(M_PI), PHP_EOL;
echo rad2deg(M_PI_2), PHP_EOL;
echo rad2deg(M_PI_4), PHP_EOL; How It Works
- M_PI is half a circle, which is 180 degrees.
- M_PI_2 is a quarter of a circle, which is 90 degrees.
- M_PI_4 is an eighth of a circle, which is 45 degrees.
- PHP prints whole floats without decimals.

