PHP atan2()
Published Jul 12, 2023
Contribute to Docs
The atan2() function returns the arc tangent of y/x, in radians.
Syntax
atan2(y,x);
The atan2() function has two parameters. It returns the arc tangent of y/x, in radians. Where x and y are the coordinates of a point (x, y). Both specify a positive or negative number.
Example
The following code uses atan2() to return the arc tangent of (-10,8):
<?phpecho atan2(-10,8);?>
This results in the following output:
-0.89605538457134
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn PHP on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours