PHP: atan2() function
Description
The atan2() function is used to calculate the arc tangent of the two variables.
Version:
(PHP 4 and above)
Syntax:
atan2( ny, nx )
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
nx | Divisor number | Required | Float |
ny | Dividend number | Required | Float |
Return value:
The arc tangent of ny/nx in radians.
Value Type: Float.
Pictorial Presentation:
Example:
<?php
echo(atan2(0.45,0.45) . "<br />");
echo(atan2(-0.40,-0.40) . "<br />");
echo(atan2(6,7) . "<br />");
echo(atan2(15,30) . "<br />");
echo(atan2(-6,-6) . "<br />");
echo(atan2(-20,20))
?>
Output:
0.785398163397 -2.35619449019 0.708626272128 0.463647609001 -2.35619449019 -0.785398163397
View the example in the browser
See also
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/php/function-reference/atan2.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics