Home >>PHP Math Functions >PHP sin() Function

PHP sin() Function

PHP sin() Function

PHP sin() function is used to find the sine value of any given input number. It returns a float value between the range of -1 and 1, which represents the sine of the given angle passed to it as argument. The given argument parameter value must be in radians. It accepts only a single parameter $number which is the number whose sine value is to be found.

Syntax:

  sin($number);

Parameter Values

Parameter Description
number This is a required parameter. This parameter defines the input value in radians.

Here is an example of sin() function in PHP:

<html>
<body>

<?php

echo sin(0)."<br>";
echo sin(1)."<br>";
echo sin(1.5)."<br>";
echo sin(2)."<br>";

?>

</body>
</html>
Output:
0
0.8414709848079
0.99749498660405
0.90929742682568

Here is another example of sin() function in PHP:

<html>
<body>

<?php

echo sin(0)."<br>";
echo sin(pi()/2)."<br>";
echo sin(pi()/4)."<br>";
echo sin(pi()/6)."<br>";
echo sin((3*M_PI)/2)."<br>";

?>

</body>
</html>
Output:
0
1
0.7
0.5
-1

No Sidebar ads