PHP函数phptan()是PHP中的一个内置函数,它可以计算一个数字的正切值。它的语法如下:
float phptan ( float $arg )
其中,$arg参数是一个浮点数,表示要计算正切值的角度(以弧度表示)。
实例
$a = phptan(1.5); echo "The tangent of 1.5 is: " . $a;
以上实例输出结果如下:
The tangent of 1.5 is: 1.61977519054
phptan()函数还可以用于计算三角函数的正切值:
$a = phptan(90); echo "The tangent of 90 is: " . $a;
以上实例输出结果如下:
The tangent of 90 is: -1.995200412208
phptan()函数也可以用于计算任意角度的正切值:
$a = phptan(45); echo "The tangent of 45 is: " . $a;
以上实例输出结果如下:
The tangent of 45 is: 1.61977519054