Cos Function in PHP



The cos() function Returns the cosine of a number. A numeric value between -1 and 1 is Returned representing the cosine of the angle.

Syntax

cos(num)

Parameters

  • num − The specified value in radians

Return

The cos() function Returns cosine of a number in float. A numeric value between -1 and 1 is Returned representing the cosine of the angle.

Example

 Live Demo

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

Output

0.54030230586814<br>0.54030230586814

Example

Let us see another example −

 Live Demo

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

Output

1
Updated on: 2019-12-26T10:34:00+05:30

105 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements