Home >Backend Development >PHP Problem >How to define pi in php
PHP pi() function
Definition and usage
pi() The function returns the value of pi.
Grammar (Recommended learning: PHP programming from entry to proficiency)
pi()
Instructions
Returns the approximate value of pi. The float precision of the return value is determined by the precision directive in php.ini. The default value is 14. You can also use the M_PI constant, which produces exactly the same result as pi().
Example
<?php echo pi(); ?>
Output similar to:
3.14159265359
The above is the detailed content of How to define pi in php. For more information, please follow other related articles on the PHP Chinese website!