atan2()

arisdelaCruz1413618857's avatar
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):

<?php
echo atan2(-10,8);
?>

This results in the following output:

-0.89605538457134

All contributors

Contribute to Docs

Learn PHP on Codecademy