PHP Tutorial - PHP atan2() Function






Definition

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

Syntax

PHP atan2() function has the following syntax.

atan2(y,x);

Parameter

The parameters for PHP atan2() function are listed below.

ParameterIs Required Description
y Required. Dividend
xRequired.Divisor

Return

Item Value
Return Value The arc tangent of y/x in radians, which is between -Pi and Pi
Return TypeFloat




Example

Return the arc tangent of two variables with the atan2() function:


<?php
echo(atan2(-10,10));
?>

The code above generates the following result.