w3resource

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:

php math atan2() function

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

PHP Function Reference

Previous: asinh
Next: atan



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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://www.w3resource.com/php/function-reference/atan2.php