Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP atan2() Function

PHP atan2() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Return the arc tangent of two variables via atan2():

"); echo(atan2(-0.50,-0.50) . "
"); echo(atan2(5,5) . "
"); echo(atan2(10,20) . "
"); echo(atan2(-5,-5) . "
"); 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

);

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

Technical Details

Return Value: The arc tangent of y/x, in radians, with a value between -Pi and Pi.
Return Type: Float
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual