w3resource

PHP: sin() function

Description

The sin() function is used to get the sine of a number.

Version:

(PHP 4 and above)

Syntax:

sin(num)

Parameter:

Name Description Required /
Optional
Type
num A value in radian. Required Foat.

Return value:

The sine of num.

Value Type: Float.

Pictorial Presentation

php-math-sin()

Example:

<?php
$val1= 0;
$val2=4;
$val3=-4;
$zsin1=sin($val1);
$zsin2=sin($val2);
$zsin3=sin($val3);
echo "Sine of $val1 is $zsin1<br />";
echo "Sine of $val2 is $zsin2<br />";
echo "Sine of $val3 is $zsin3<br />";
?>

Output:

Sine of 0 is 0
Sine of 4 is -0.756802495308
Sine of -4 is 0.756802495308

View the example in the browser

See also

PHP Function Reference

Previous: round
Next: sinh



Follow us on Facebook and Twitter for latest update.