PHP acos() Function
Definition and Usage
The acos() function returns the inverse cosine of a number.
Syntax
acos(x)
Parameter | Description |
---|---|
x | Required. A number, ranging between -1 and 1. |
Description
returns x inverse cosine value, in radians. acos() is cos() is the inverse function, which means that each value within the range of acos() is a==cos(acos(a)).
if x is outside the range of -1 to 1, then -1.#IND is returned. If it is -1, then the value of PI is returned.
Example
In this example, we will calculate the inverse cosine of different values:
<?php echo(acos(0.64)); echo(acos(0)); echo(acos(-1)); echo(acos(1)); echo(acos(2)); ?>
Output:
0.876298061168 1.57079632679 3.14159265359 0 -1.#IND