Home >>PHP Math Functions >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 | 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>
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>