The sin()
function calculates the sine value.
PHP sin() Function has the following syntax.
float sin ( float num )
Parameter | Description |
---|---|
number | Required. Specifies a value in radians |
The parameter should be passed as radians.
We should use deg2rad()
to convert degrees to radians.
PHP sin() Function returns the sine value.
Return the sine of different numbers
<?php/* ww w .j av a 2 s . co m*/
echo(sin(3) . "\n");
echo(sin(-3) . "\n");
echo(sin(0) . "\n");
echo(sin(M_PI) . "\n");
echo(sin(M_PI_2) . "\n");
$sin1 = sin(10);
print($sin1);
print "\n";
$sin2 = sin(deg2rad(80));
print($sin2);
?>
The code above generates the following result.