How to use cos in PHP

This article describe about cos() Function in PHP.
  • 1263

cos() Function

The cosine of number return by the cos() function.

Syntax

cos(x)

 

Parameter Description
x Required a number

Note: This function return numeric value between -1 to 1 only.

Example

<html>
<body>
<?php
echo(cos(5) . "<br />");
echo(cos(-5) . "<br />");
echo(cos(0) . "<br />");
echo(cos(M_PI) . "<br />");
echo(cos(3*M_PI))
?>
</body>
</html>

 

Output


cosphp.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.