PHP atan()函数
PHP atan() 函数用于解决三角函数问题。它返回arg的反正切值,作为介于Pi/2和pi/2弧度之间的数值。
语法
atan(arg);
参数 | 描述 | 必填/可选 |
---|---|---|
arg | 指定要处理的参数。 | 必填 |
示例1
<?php
num=(0.5);
echo "Passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Passing number is :0.5
By using 'atan()' function your number is :0.46364760900081
示例2
<?php
num=(-0.50);
echo "Passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Passing number is :-0.5
By using 'atan()' function your number is :-0.46364760900081
示例3
<?php
num=5;
echo "Your passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Your passing number is :5
By using 'atan()' function your number is :1.373400766945
示例4
<?php
num=(-5);
echo "Your passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Your passing number is :-5
By using 'atan()' function your number is :-1.373400766945
示例5
<?php
num=200;
echo "Your passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Your passing number is :200
By using 'atan()' function your number is :1.5657963684609
示例6
<?php
num=-200;
echo "Your passing number is :".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
Your passing number is :-200
By using 'atan()' function your number is :-1.5657963684609
示例7
<?php
num=(3*pi()/2);
echo "passing number (3*pi()/2) is: ".num;
echo "<br>"."By using 'atan()' function your number is :".(atan($num));
?>
输出:
passing number (3*pi()/2) is: 4.7123889803847
By using 'atan()' function your number is :1.3616916829712