Example 1 — Basic atan() usage
This example prints the arc tangent of zero, one and minus one.
<?php
echo atan(0) . PHP_EOL;
echo round(atan(1), 4) . PHP_EOL;
echo round(atan(-1), 4) . PHP_EOL;
echo round(atan(0.5), 4) . PHP_EOL; How It Works
- atan(0) is 0 because the tangent of 0 is 0.
- atan(1) is pi / 4, which rounds to 0.7854.
- atan(-1) is the negative of atan(1), so it is -0.7854.
- atan(0.5) is about 0.4636 radians, which is smaller because the slope is gentler.

