PHP sin() Function

Definition and Usage

The sin() function returns the sine ratio of given angle in radians. In trigonometry, sine of an angle is defined as ratio of lengths of opposite side and hypotenuse.

sin(x) = opposite/hypotenuse

If x=90 degree, sin(x) = 1 as opposite side of right angle is a hypotenuse

This function returns a float value.

Syntax

sin ( float $arg ) : float

Parameters

Sr.No Parameter & Description
1 arg
A floating point value that represents angle in radians

Return Values

PHP sin() function returns sine ratio of given parameter.

PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

Example

<?php
   $arg=M_PI; // pi
   $val=sin($arg);
   echo "sin(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

sin(3.1415926535898) = 1.2246467991474E-16
Updated on: 2026-03-11T23:22:53+05:30

298 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements