PHP Tutorial PHP Advanced PHP Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

PHP - Math sin() Function



The PHP Math sin() function returns trigonometric sine of an angle (angle should be in radians). In the graph below, sin(x) vs x is plotted.

Sin Function

Syntax

sin(number)

Parameters

number Required. Specify the angle in radian.

Return Value

Returns the trigonometric sine of an angle.

Example:

In the example below, sin() function is used to find out the trigonometric sine of an angle.

<?php
echo sin(pi()/6)."\n";
echo sin(pi()/4)."\n";
echo sin(pi()/3)."\n";  
?>

The output of the above code will be:

0.5
0.70710678118655
0.86602540378444

❮ PHP Math Functions

5