float acos ( float $arg )
acos() returns the arc cosine of $arg in radians. acos() is the complementary function of the cos().
※ available F/W version : all
Returns the arc cosine of $arg in radians
<?php
$rad = 1.0;
$val1 = cos($rad);
$val2 = acos($val1);
echo "cos($rad) = $val1\r\n"; // OUTPUT: cos(1) = 0.54030230586814
echo "acos($val1) = $val2\r\n"; // OUTPUT: acos(0.54030230586814) = 1
?>
<?php
// 1.1 is invalid argument for the acos() so it returns NAN (Not A Number)
$val = acos(1.1);
echo "acos(1.1) = $val\r\n"; // OUTPUT: acos(1.1) = NAN
?>
This function is identical to the PHP group’s acos() function.