PHP cos() Function
Example
Return the cosine of different numbers:
"); echo(cos(-3) . ""); echo(cos(0) . "
"); echo(cos(M_PI) . "
"); echo(cos(2*M_PI)); ?>
Run Example »
Definition and Usage
The cos() function returns the cosine of a number.
Note: cos() returns a value between -1 and 1, representing the cosine of the angle.
Syntax
cos(
number
);
| Parameters | Description |
|---|---|
| number | Required. Specifies a number. |
Technical Details
| Return Value: | number The cosine of. |
|---|---|
| Return Type: | Float |
| PHP Version: | 4+ |
PHP Math Reference Manual