Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
PHP cos() Function
Definition and Usage
The cos() function returns the cosine ratio of given angle in radians. In trigonometry, cosine of an angle is defined as ratio of lengths of adjacent side and hypotenuse.
cos(x) = adjacent/hypotenuse
If x=90 degree, cos(x) = 0.
This function returns a float value.
Syntax
cos ( float $arg ) : float
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
arg A floating point value that represents angle in radians |
Return Values
PHP cos() function returns cosine ratio of given parameter.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
<?php
$arg=M_PI;
$val=cos($arg);
echo "cos(" . $arg . ") = " . $val;
?>
Output
This will produce following result −
cos(3.1415926535898) = -1
Advertisements
