SIN(): sine of a specified angle given in Radians

SIN(X);
X is the angular value in radian. We get output as Sin of the input angle.
<?Php
echo SIN(PI()); // Output is 1.2246467991474E-16  // same as 0 
echo "<br>";
echo SIN(PI()/2); // Output  1 
echo "<br>";
echo SIN(PI()/3); // Output is 0.86602540378444
echo "<br>";
echo SIN(PI()/4); // Output is 0.70710678118655 
?>

deg2rad() with SIN()

We can use deg2rad() to convert Degree value to radian and then use SIN().
<?Php
echo SIN(deg2rad(0)); // Output  is 0
echo "<br>";
echo SIN(deg2rad(90)); // Output is 1
echo "<br>";
echo SIN(deg2rad(180)); // Output  is 1.2246467991474E-16 // same as 0 
?>

Example: Sine of Negative Angles

$angle = -30;
echo sin(deg2rad($angle));  // Output: -0.5

Example: Using Sin in Waveform Calculations

$frequency = 50;
$time = 0.02;
echo sin(2 * M_PI * $frequency * $time);  // Output: waveform at specific time

Example: Sine of 45 Degrees

$angle = 45;
echo sin(deg2rad($angle));  // Output: 0.70710678118655

Example: Sine of Large Angles

$angle = 720;  // Angle greater than 360 degrees
echo sin(deg2rad($angle));  // Output: 0 (Since sin(720) = sin(0))

Example: Sine in a Triangle

$hypotenuse = 10;
$opposite = 5;
$angle = rad2deg(asin($opposite / $hypotenuse));
echo $angle;  // Output: 30 degrees
These examples expand on how to use the `sin()` function in common scenarios, such as calculating angles and dealing with large values.

Plotting of SIN & SIN curves by using PHP GD function with deg2rad()


Math Functions SIN() function rad2deg() function
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer