Javatpoint Logo
Javatpoint Logo

PHP cos() Function

The cos() function is predefined PHP function. It is used to return the cosine of a number. It returns a numeric value between -1 and 1, which represents the cosine of the angle.

Syntax:

Parameter Description Required/Optional
number Specify a number Required

Example 1

Output:

Your number is : 3
By using 'cos()' function your number is :-0.98999249660045

Example 2

Output:

Your number is : -3
By using 'cos()' function your number is :-0.98999249660045

Example 3

Output:

Your number is : 0
By using 'cos()' function your number is :1

Example 4

Output:

Your number is : M_PI
By using 'cos()' function your number is :-1

Example 5

Output:

Your number is 2*M_PI: 6.2831853071796
By using 'cos()' function your number is :1

Next TopicPHP Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA