PHPerKaigi 2024

acos

(PHP 4, PHP 5, PHP 7, PHP 8)

acosArc cosine

Description

acos(float $num): float

Returns the arc cosine of num in radians. acos() is the inverse function of cos(), which means that $num == cos(acos($num)) for every value of num that is in the domain of acos().

Parameters

num

The argument to process

Return Values

The arc cosine of num in radians.

See Also

add a note

User Contributed Notes 1 note

up
-19
rahmatjon at gmail dot com
3 years ago
Hello!
There is no any example for acos() function. Please put this one below the acos() function's description.
Thank you!

Example:
<?php
$arg
=0.5;
$val=acos($arg);
echo
"acos(" . $arg . ") = " . $val . " radians.<br/>";
echo
"Pi value = " . pi() . "<br/>";
echo
"acos(" . $arg . ") = " . $val/pi()*180 . " degrees<br/>";
?>
To Top