Home >>PHP Math Functions >PHP acos() Function
PHP acos() function is used to find the arc cosine value of a given input number in radians. It is the complementary function of cos(). The parameter passed in it should be a number in the range of -1 to 1.
Syntax:
acos($number);
Parameter | Description |
---|---|
number | This is a required parameter. This parameter defines a number in range -1 to 1. |
Here is an example of acos() function in PHP:
<html> <body> <?php echo acos(0.54)."<br>"; echo acos(-0.54)."<br>"; ?> </body> </html>
Here is an another example of acos() function in PHP:
<html> <body> <?php echo acos(0)."<br>"; echo acos(-1)."<br>"; echo acos(1)."<br>"; echo acos(2); // value should be in the range of 1 to -1. ?> </body> </html>