THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP atan2() Function

PHP Math Reference PHP Math Reference

Example

Return the arc tangent of two variables with 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));
?>
Run example »

Definition and Usage

The atan2() function returns the arc tangent of two variables x and y.


Syntax

atan2(y,x);

Parameter Description
y Required. Specifies the dividend
x Required. Specifies the divisor

Technical Details

Return Value: The arc tangent of y/x in radians, which is between -Pi and Pi
Return Type: Float
PHP Version: 4+

PHP Math Reference PHP Math Reference