<?Php
echo atan(0); // Output is 0
echo "<br>";
echo atan(1); // Output 0.78539816339745
echo "<br>";
echo atan(-1); // -0.78539816339745
echo "<br>";
echo atan(4); // Output is 1.325817663668
echo "<br>";
echo atan(2); // Output is 1.1071487177941
echo "<br>";
echo atan(90); // Output is 1.5596856728973
?>
atan(X);
X is the angular value in radian. We get output as ARC tangent of the input angle.
<?Php
echo atan(deg2rad(45)); // Output 0.66577375002835
echo "<br>";
echo atan(deg2rad(90)); // Output 1.0038848218539
echo "<br>";
echo atan(deg2rad(180)); // Output 1.2626272556789
echo "<br>";
echo atan(deg2rad(1)); // Output 0.017451520651466
echo "<br>";
echo atan(deg2rad(-1)); // Output -0.017451520651466
echo "<br>";
echo atan(deg2rad(-4)); // Output -0.069700080299613
echo "<br>";
echo atan(deg2rad(-90)); // Output -1.0038848218539
echo "<br>";
echo atan(deg2rad(-180)); // Output -1.2626272556789
?>
$opposite = 5;
$adjacent = 10;
$angle = atan($opposite / $adjacent); // Result in radians
$angle_in_degrees = rad2deg($angle);
echo $angle_in_degrees; // Output: 26.565 degrees
echo atan(0); // Output: 0
echo atan(-1); // Output: -0.785398163 (negative angle)
$y = 5;
$x = 10;
echo atan($y / $x); // Output: 0.463 radians
// Using atan2 to handle full quadrant angles
echo atan2($y, $x); // Output: 0.463 radians (same, but handles quadrant correctly)
Explanation: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.