PHP atan2

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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 :

  1. echo(atan2(0.45,0.45) . "
    ");  

  2. echo(atan2(-0.40,-0.40) . "
    ");  

  3. echo(atan2(6,7) . "
    ");  

  4. echo(atan2(15,30) . "
    ");  

  5. echo(atan2(-6,-6) . "
    ");  

  6. echo(atan2(-20,20))  

  7. ?>  

Output :

0.785398163397
-2.35619449019
0.708626272128
0.463647609001
-2.35619449019
-0.785398163397