PHP tan()函数
tan() 函数是PHP的三角函数数学函数,用于计算三角问题。它返回一个数的正切值。
语法
tan(number);
参数 | 描述 | 必需/可选 |
---|---|---|
number | 指定一个以弧度为单位的值 | 必需 |
示例1
<?php
num=M_PI_4;
echo "Your number is M_PI_4 = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Your number is M_PI_4 = 0.78539816339745
By using 'tan()' function your number is :1
示例2
<?php
num=(0.50);
echo "Your number is = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Your number is = 0.5
By using 'tan()' function your number is :0.54630248984379
示例3
<?php
num=(-0.50);
echo "Your number is = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Your number is = -0.5
By using 'tan()' function your number is :-0.54630248984379
示例4
<?php
num=(5);
echo "Your number is = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Passing number is = 5
By using 'tan()' function your number is :-3.3805150062466
示例5
<?php
num=(10);
echo "Passing number is = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Passing number is = 10
By using 'tan()' function your number is :0.64836082745909
示例6
<?php
num=(-5);
echo "Passing number is = ".num;
echo "<br>"."By using 'tan()' function your number is :".(tan($num));
?>
输出:
Passing number is = -5
By using 'tan()' function your number is :3.3805150062466
示例7
<?php
num=(0.50);
echo "Passing number is (0.50)";
echo "<br>"."By using 'tan()' function your number is :".(tan(num));
?>
输出:
Passing number is :0.5
By using 'tan()' function your number is :0.54630248984379
示例8
<?php
num=(3*pi()/2);
echo "Passing number is : 3*pi()/2";
echo "<br>"."By using 'tan()' function your number is :".(tan(num));
?>
输出:
Passing number is : 3*pi()/2
By using 'tan()' function your number is :5.4437464510651E+15