atan2()
atan2() — Arc tangent of two variables.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.
Signature
atan2(float $y, float $x): float
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $y | float | Dividend parameter |
| $x | float | Divisor parameter |
Return value
The arc tangent of y/x in radians.
Example
The PHP manual ships no example for atan2(); the signature and the parameter table above are the contract.
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page atan2() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.