TAN(X);
X is the angular value in radian. We get output as TANGENT of the input value.
<?Php
echo TAN(PI()); // Output is 0
echo "<br>";
echo TAN(PI()/2); // Output is infinity
echo "<br>";
echo ROUND(TAN(PI()/3),2); // Output is 1.73
echo "<br>";
echo TAN(PI()/4); // Output is 1
?>
<?Php
echo TAN(deg2rad(0)); // Output is 0
echo "<br>";
echo TAN(deg2rad(90)); // Output is 1.6331239353195E+16 // same as infinity
echo "<br>";
echo TAN(deg2rad(180)); // Output is -1.2246467991474E-16// same as 0
?>
$angle = 90;
echo tan(deg2rad($angle)); // Output: Large value (Infinity)
$angle = 45;
$adjacent = 10;
$opposite = $adjacent * tan(deg2rad($angle)); // Output: 10 (Height of the triangle)
echo $opposite;
$angle = 30;
echo tan(deg2rad($angle)); // Output: 0.57735026918963
$angle = -45;
echo tan(deg2rad($angle)); // Output: -1
$angle = 30; // Angle of elevation
$distance = 100; // Distance from object
$height = $distance * tan(deg2rad($angle)); // Calculate height
echo $height; // Output: 57.735026918963
Plotting of SIN & SIN curves by using PHP GD function with deg2rad()
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.