Latest web development tutorials

PHP atan2 () function

PHP Math Reference PHP Math Reference

Examples

By atan2 () function returns the arc tangent of two variables:

<?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));
?>

Running instance »

Definition and Usage

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


grammar

atan2( y,x );

参数 描述
y 必需。规定被除数。
x 必需。规定除数。

technical details

return value: y / x arctangent, in radians, whose value is between -Pi and Pi.
Return type: Float
PHP version: 4+


PHP Math Reference PHP Math Reference