PHP sin() Function

Definition and Usage

The sin() function returns the sine of a number.

Syntax

sin(x)
Parameter Description
x Required. A number.

Description

The sin() function returns a parameter x sine value. x The unit is radians.

Tips and Comments

Note:The value returned by the sin() function is between -1 and 1.

Example

In this example, we will calculate the sine of different values:

<?php
echo(sin(3));
echo(sin(-3));
echo(sin(0));
echo(sin(M_PI));
echo(sin(M_PI_2))
?>

Output:

0.14112000806
-0.14112000806
0
1.22460635382E-016
1