Trigonometry is one of the most important concepts in Mathematics. PHP acos is an inbuilt Math Function in PHP. It calculates the arc cosine of a number in radians which works the opposite of PHP cos Function. In this article, we will discuss the PHP acos Function. Also, we will discuss an example of using it.
Syntax
float acos ($value)
Parameters
The function expects only one parameter. The number for which you want to find the arc cosine value is the input to the function. Also, the input value must be in the value between -1 and 1. However, if the input lies outside this range, the function returns NAN.
Return Value
The function returns a float value which is the arc cosine value of the input value. However, if the input value is not in between -1 and 1, the function returns NAN.
Input: acos(1) Output: 0 Input: acos(-1) Output: 3.1415926535898 Input: acos(0) Output: 1.5707963267949 Input: acos(0.5) Output: 1.0471975511966 Input: acos(2) Output: NAN

Example
For example, consider the following example of using the function to determine the arc cosine value of a number.
<?php echo acos(1); echo acos(-1); echo acos(0); echo acos(0.5); echo acos(2); ?>
The above example prints the following.
Output: 0 3.1415926535898 1.5707963267949 1.0471975511966 NAN
Conclusion
In conclusion, we discussed the PHP acos function. Additionally, you can read more about it on the Official Documentation of PHP. Also, you can read more on PHP Math Functions on Concatly.

Vishesh is currently working as an Intermediate Software Engineer with Orion Health, New Zealand. He graduated with a Masters in Information Technology from the University of Auckland in 2021. With more than 4 years of work experience, his expertise includes Java, Python, Machine Learning, PHP, Databases, Design and Architecture.