PHP atan2() Function

In this chapter you will learn:

  1. Definition for PHP atan2() Function
  2. Syntax for PHP atan2() Function
  3. Parameter for PHP atan2() Function
  4. Return for PHP atan2() Function
  5. Example - Return the arc tangent of two variables

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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP atanh() Function
  2. Syntax for PHP atanh() Function
  3. Parameter for PHP atanh() Function
  4. Return for PHP atanh() Function
  5. Example - Return the inverse hyperbolic tangent of different numbers