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

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 26-Dec-2019

73 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements