English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

cos() function in PHP

Thecos()The function returns the cosine value of a number. The return value is between-1and1The numbers between indicate the cosine of the angle.

Syntax

cos(num)

parameter

  • num-the specified value in radians

returns

Thecos()the function returns the cosine value as a floating-point number. The return value is between-1and1The numbers between indicate the cosine of the angle.

Example

<?php
   echo(cos(1)) . "<br>";
   echo(cos(-1));
?>

Output Result

0.54030230586814<br>0.54030230586814

Example

Let's look at another example-

<?php
   echo(cos(0));
?>

Output Result

1