(PHP 4, PHP 5, PHP 7, PHP 8)
acos — 反余弦
返回 num 的反余弦值,单位是弧度。acos()
是 cos() 的反函数,它的意思是对于 acos()
的定义域中的每个 num 值,$num == cos(acos($num))。
num要处理的参数
num 的反余弦弧度。
Parameter:
$num: A float value between -1 and 1. (Outside this range will return NAN)
Returns:
The arc cosine of the number in radians.
NAN (Not A Number) if the input is outside [-1, 1].
<?php
$cosValue = 0.5;
$angle = acos($cosValue); // returns angle in radians
echo $angle; // 1.0471975512 (which is ~60 degrees)
echo rad2deg($angle); // Convert to degrees: ~60
?>