PHP acos()Function
Examples
Returns the arc cosine of different numbers:
<?php
echo(acos(0.64) . "<br>");
echo(acos(-0.4) . "<br>");
echo(acos(0) . "<br>");
echo(acos(-1) . "<br>");
echo(acos(1) . "<br>");
echo(acos(2));
?>
echo(acos(0.64) . "<br>");
echo(acos(-0.4) . "<br>");
echo(acos(0) . "<br>");
echo(acos(-1) . "<br>");
echo(acos(1) . "<br>");
echo(acos(2));
?>
Run example »
Definition and Usage
The acos() function returns the arc cosine of a number.
Tip:acos(-1) returns the value of Pi.
Syntax
acos(number);
| Parameter | Description |
|---|---|
| number | Required. Specifies a number in the range -1 to 1. |
Technical Details
| Return value: | numberthe arc cosine of. Ifnumberis not in the range -1 to 1, then NAN is returned. |
|---|---|
| Return type: | Float |
| PHP Version: | 4+ |
PHP Math Reference Manual Other Extensions