Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math acos() function returns arc cosine of a value. The return value will be in the range 0 through 𝜋.

Note: acos() is the inverse of cos().

Syntax

acos(number)

Parameters

number Required. Specify the value.

Return Value

Returns the arc cosine of the value.

Example:

In the below example, acos() function is used to find out the arc cosine of a given value.

<?php
echo acos(0.5)."\n";
echo acos(1)."\n";
echo acos(2)."\n";
?>

The output of the above code will be:

1.0471975511966
0
NAN

❮ PHP Math Functions