PHP rad2deg() 函数
PHP rad2deg() 函数用于将弧度值转换为角度值。
语法
float rad2deg ( float $number );
给定的函数将弧度转换为度。
参数 | 描述 | 必填/可选 |
---|---|---|
number | 指定要转换的弧度值 | 必填 |
示例1
<?php
radian=0;
echo "Your radian value is = ".radian."<br>";
echo "By using 'rad2deg()' function, Converted Degree value is :".rad2deg($radian);
?>
输出:
Your radian value is = 0
By using 'rad2deg()' function, Converted Degree value is :0
示例2
<?php
echo "Your Number is : M_PI_4";
echo "By using 'rad2deg()' function, your radian equivalent is :".rad2deg(M_PI_4);
?>
输出:
Your Number is : M_PI_4
By using 'rad2deg()' function, your radian equivalent is :45
示例3
<?php
radian=pi();
echo "Your radian value is pi() :".radian."<br>";
echo "By using 'rad2deg()' function, Converted Degree value is :".rad2deg($radian);
?>
输出:
Your radian value is pi() :3.1415926535898
By using 'rad2deg()' function, Converted Degree value is :180
示例4
<?php
radian=(pi()/4);
echo "Your radian value is (pi()/4) = ".radian."<br>";
echo "By using 'rad2deg()' function, Converted Degree value is :".rad2deg($radian);
?>
输出:
Your radian value is (pi()/4) = 0.78539816339745
By using 'rad2deg()' function, Converted Degree value is :45