PHP asin()函数
asin()函数是预定义的PHP三角函数。它用于计算三角问题。它返回在-1和1之间的数的反正弦。
语法
asin($value)
参数 | 描述 | 必须/可选 |
---|---|---|
$value | 指定一个介于-1到1之间的数字 | 必须 |
注意:asin(1) 返回 Pi/2 的值。
示例1
<?php
num=0 ;
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : 0
By using 'asin()' function your number is :0
示例2
<?php
num=1;
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : 1
By using 'asin()' function your number is :1.5707963267949
示例3
<?php
num=-1;
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : -1
By using 'asin()' function your number is :-1.5707963267949
示例4
<?php
num=(-0.4);
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : -0.4
By using 'asin()' function your number is :-0.41151684606749
示例5
<?php
num=(0.64);
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : 0.64
By using 'asin()' function your number is :0.69449826562656
示例6
<?php
num=2;
echo "Your number is : ".num;
echo "<br>"."By using 'asin()' function your number is :".(asin($num));
?>
输出:
Your number is : 2
By using 'asin()' function your number is :NAN