Home >>PHP Math Functions >PHP atan2() Function
PHP atan2() function is used to calculate the arc tangent of two given input variables x and y passed to it as the arguments. It returns the output in radians having the value between -Pi and Pi.
Syntax:
atan2($x,$y);
Parameter | Description |
---|---|
X | This is a required parameter. This parameter defines the dividend. |
Y | This is a required parameter. This parameter defines the divisor. |
Here is an example of atan2() function in PHP:
<html> <body> <?php echo atan2(0.59,0.59)."<br>"; echo atan2(-0.78,-0.78)."<br>"; echo atan2(10,5)."<br>"; ?> </body> </html>
Here is an another example of atan2() function in PHP:
<html> <body> <?php echo atan2(10,10)."<br>"; echo atan2(-10,-10)."<br>"; echo atan2(10,-5)."<br>"; echo atan2(-10,5)."<br>"; ?> </body> </html>