Example 1 — Tangent of Common Angles
Try tan() with a few familiar angles.
<?php
echo tan(0), PHP_EOL;
echo round(tan(M_PI_4), 2), PHP_EOL;
echo round(tan(deg2rad(60)), 4), PHP_EOL; How It Works
- tan(0) is 0 because sine of 0 is 0.
- M_PI_4 is 45 degrees, and its tangent is 1.
- deg2rad(60) converts 60 degrees to radians.
- The tangent of 60 degrees is about 1.7321 after rounding.

