PHP pi() Function

In this chapter you will learn:

  1. Definition for PHP pi() Function
  2. Syntax for PHP pi() Function
  3. Parameter for PHP pi() Function
  4. Return for PHP pi() Function
  5. Example - Get the value of PI

Definition

The pi() function returns the value of PI.

The named constant M_PI is identical to pi().

Syntax

PHP pi() Function has the following syntax.

pi();

Parameter

None

Return

Item Description
Return Value 3.1415926535898
Return TypeFloat

Example

Return the value of PI:


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

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP pow() Function
  2. Syntax for PHP pow() Function
  3. Parameter for PHP pow() Function
  4. Return for PHP pow() Function
  5. Example - Raise to the power