September 2001
Intermediate to advanced
768 pages
32h 45m
English
float pi(void)
Returns the value of pi.
Returns:
Value of pi
Description:
Returns a double containing the value of pi. The number of decimal places is system-specific; for instance, on a Linux x86 box the value returned is 3.1415926535898.
Note that it will be slightly faster in most cases to simply use the named constant M_PI, which is provided by PHP. The pi() function simply returns this value.
Version:
PHP 3, PHP 4
Example:
$radius = 6; $area = pi() * pow($radius, 2); // area = pi * r^2 echo "Area of circle with radius $radius is $area"; |
Read now
Unlock full access