PHP 7.1.21 Released

cos

(PHP 4, PHP 5, PHP 7)

cos余弦

说明

float cos ( float $arg )

cos() 返回参数 arg 的余弦值。参数 arg 的单位为弧度。

参数

arg

以弧度表示的角度

返回值

arg的余弦值

范例

Example #1 cos() 例子

<?php

echo cos(M_PI); // -1

?>

参见

add a note add a note

User Contributed Notes 2 notes

up
5
felipensp at gmail dot com
12 years ago
Convert degree to radianus, radianus to cos.

<?php

   
// Degree
   
$degree = 360;

   
// Convertion
   
print cos(deg2rad($degree));

?>
up
-70
shrinivasmani at gmail dot com
4 years ago
Convert degree to radianus

<?php

   
// Degree
   
$degree = 360;

   
// Convertion
   
print cos(deg2rad($degree));

?>
To Top