pi() function in PHP


The pi() function Returns the value of Pi (π).

Syntax

pi()

Parameters

  • NA

Return

The pi() function Returns the approximate value of PI. This value is a floating point value.

3.1415926535898

Example

 Live Demo

<?php
   echo(pi());
?>

Output

3.1415926535898

Example

Let us see another example to get the value of PI

 Live Demo

<?php
   echo M_PI;
?>

Output

3.1415926535898

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 27-Dec-2019

73 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements