pi


pi apg

RETURNS an aproximation of the π, (pi), value.

Compatible with LOCALE only, up to PHP 7.4.XX.





This function returns a FLOAT value with the precision based on the directive set in the php.ini, which defaults to 14.

The constant M_PI has identical value to this function.



<?php

float pi 
( void )

?>

  1 EXERCISE   

<?php

echo 'PHP ' . PHP_VERSION . '<br><br>';

setlocale(LC_ALL, 'de', 'de-DE', 'de_DE'); 
 
$pival01a = pi();

$pival01b = M_PI;

echo 
'π = ' . $pival01a . 
'<br><br>Which has the same value as the constant: 
 <br><br>M_PI = ' 
. $pival01b;

?>