# PI() : Constant Value

``PI();``
Contstant value equal to 3.1415926535898.
```<?Php
echo PI(); // Output is 3.14159265358983
echo M_PI; // Output is 3.1415926535898
?>```

## PI() with ROUND()

``````<?Php
echo round(PI(),2); // Output is 3.14
echo "<br>";
echo round(PI()/2,2); // Output is 1.57
echo "<br>";
echo round(M_PI_4,2); // Output is 0.79
?>``````

## Values of M_PI

```echo M_PI_2; // Output is 1.5707963267949 // same as PI()/2
echo "<br>";
echo M_PI_4; // Output is 0.78539816339745 // same as PI()/4
```
```echo M_1_PI; // Output is 1.5707963267949 // same as 1/PI()
echo "<br>";
echo M_2_PI; // Output is 0.78539816339745 // same as 2/PI()
```

```echo rad2deg(PI()); // Output is 180
echo "<br>";
echo rad2deg(PI()/2); // Output is 90
echo "<br>";
echo rad2deg(PI()/3); // Output is 60
echo "<br>";
echo rad2deg(PI()/4); // Output is 45
```

## PI() with sin() cos()

Decimal places Sin(), cos() and other trigonometric functions takes input in radian and give sin and cosine values of angles .
``````<?Php
echo round(sin(pi()),2);// Output  is 0
echo "<br>";
echo sin(pi()/2); // Output  is 1
echo "<br>";
echo cos(pi()); // Output  is -1
echo "<br>";
echo round(cos(PI()/2),2); // Output  is 0
?>
``````
We used Round function to manage decimal places. ## Subscribe

* indicates required
Subscribe to plus2net plus2net.com

Post your comments , suggestion , error , requirements etc here .