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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions