The PHP
returns the inverse cosine of a number. To be more specific, acos()
returns the inverse cosine of a number in radians.
Figure 1 below shows the mathematical representation of the acos()
function.
To convert radians
to degrees
, use the following formula.
degrees = radians * ( 180.0 / M_PI)
float acos(num)
The acos()
function requires a number as a parameter.
acos()
returns the inverse cosine of a number that is sent as a parameter in radians. The return value lies within the interval of [0, pi]
radians.
<?php#Positive number in radiansecho("acos(0.5): ");echo (acos(0.5));echo(" Radians")?><?php#Negative number in radiansecho("acos(-0.5): ");echo (acos(-0.5));echo(" Radians")?><?php#applying acos() and then converting the result in radians to degrees#radians = 0.5echo("acos(0.5) * (180.0 / M_PI)): ");echo (acos(0.5) * (180.0 / M_PI));echo(" Degrees")?>
Free Resources