PHP cos () function
Examples
Returns the number of different cosines:
<?php
echo(cos(3) . "<br>");
echo(cos(-3) . "<br>");
echo(cos(0) . "<br>");
echo(cos(M_PI) . "<br>");
echo(cos(2*M_PI));
?>
echo(cos(3) . "<br>");
echo(cos(-3) . "<br>");
echo(cos(0) . "<br>");
echo(cos(M_PI) . "<br>");
echo(cos(2*M_PI));
?>
Running instance »
Definition and Usage
cos () function returns the cosine of a number.
Note: cos () function returns a number between -1 and 1, representing the cosine of the angle.
grammar
cos( number );
参数 | 描述 |
---|---|
number | 必需。规定一个数。 |
technical details
return value: | number of cosine. |
---|---|
Return type: | Float |
PHP version: | 4+ |
PHP Math Reference