PHP atan2() Function
In this chapter you will learn:
- Definition for PHP atan2() Function
- Syntax for PHP atan2() Function
- Parameter for PHP atan2() Function
- Return for PHP atan2() Function
- 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.
Parameter | Is Required | Description |
---|---|---|
y | Required. | Dividend |
x | Required. | Divisor |
Return
Item | Value |
---|---|
Return Value | The arc tangent of y/x in radians, which is between -Pi and Pi |
Return Type | Float |
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:
- Definition for PHP atanh() Function
- Syntax for PHP atanh() Function
- Parameter for PHP atanh() Function
- Return for PHP atanh() Function
- Example - Return the inverse hyperbolic tangent of different numbers
Home » PHP Tutorial » PHP Math Functions