PHP atan2()Functions
Example
Return the arctangent of two variables using the atan2() function:
<?php
echo(atan2(0.50,0.50) . "<br>");
echo(atan2(-0.50,-0.50) . "<br>");
echo(atan2(5,5) . "<br>");
echo(atan2(10,20) . "<br>");
echo(atan2(-5,-5) . "<br>");
echo(atan2(-10,10));
?>
echo(atan2(0.50,0.50) . "<br>");
echo(atan2(-0.50,-0.50) . "<br>");
echo(atan2(5,5) . "<br>");
echo(atan2(10,20) . "<br>");
echo(atan2(-5,-5) . "<br>");
echo(atan2(-10,10));
?>
Run Example »
Definition and Usage
The atan2() function returns the arctangent of two variables x and y.
Syntax
atan2(y,x);
| Parameters | Description |
|---|---|
| y | Required. Specifies the dividend. |
| x | Required. Specifies the divisor. |
Technical Details
| Return Value: | The arctangent of y/x, in radians, with a value between -Pi and Pi. |
|---|---|
| Return Type: | Float |
| PHP Version: | 4+ |
PHP Math Reference Manual Other Extensions