Google Plus Facebook Twitter RSS YouTube

PHP sin( ) function

sin() is a trigonometric ratio in mathematical concept called Trigonometry. Programmers sometimes need to use trigonometric function sine in developing the scientific modules development through php programming. Hence, PHP programming developing team introduced sine function in PHP4 to calculate sine values for different angles through PHP programming language. It perfectly works in current programming level PHP5. It is designed and developed to return sine values for radians scale.

According to Trigonometry,

Right Angle Triangle

Ratio between opposite side and hypotenuse is called Sine. It is mathematically expressed by considering Theta (θ) as angle of the right angle triangle.

sin θ = Opposite Side
Hypotenuse

Syntax

In PHP, syntax of this mathematical function sine is defined as given below code box to understand functionality of sine function fundamentally.

PHP Code

sin(float $arg)

This fundamental syntax can be written as given below to use it quickly. It also helps php programmers to remember sine function easily.

PHP Code

sin(θ)

In this syntax, θ is an angle of the triangle.

How to use

Sine function accepts any value as angle from Real Numbers group and returns associated sine value. In PHP, specifying the angle inside the brackets makes sine function to return its associated value as output in web browser.

Program

<?php 

   echo sin(15);

?>
Output in Web Browser

0.65028784015712

In this example, sine function returned a value for an angle and it is a positive value. Similarly, sine function also gives negative values for some angles.

Program

<?php 

   echo sin(100);

?>
Output in Web Browser

- 0.50636564110976

Trigonometric function sine’s domain is R but it returns values from -1 to 1. This interval is known range of the sine function.

Follow Us
Google Plus Facebook Twitter RSS YouTube
Subscribe via Email
Save or Share This PHP Tutorial with Your Friends
Save or Share PHP Tutorial