Last Updated on May 24, 2021 by Roshan Parihar
PHP acos() Function returns the arc cosine of the given number in radians. It is the inverse or complimentary of the cos() function in PHP.
Syntax of PHP acos() Function
acos(number)
The function single argument to pass and find the arc cosine of a number.
Description of Parameters
Name | Description |
---|---|
number | Required. Specify the numeric value in the range -1 to 1 to find its arc cosine. |
Examples and Uses
1 2 3 4 5 6 7 |
<?php echo acos(-0.32)."<br>"; echo acos(0.6)."<br>"; echo acos(-1)."<br>"; echo acos(1)."<br>"; echo acos(3.4); ?> |
Output
0.92729521800161
3.1415926535898
0
NAN
The above example shows the output as the floating-point numbers. When the function takes argument acos(-1)
, it gives output as the value of pi (π)
that is ‘3.14’. The argument acos(1)
gives output zero (0) as a result.
Also, when you give argument values below -1 and above 1, the function return not applicable (NAN) as the output showing above.