Home  >  Article  >  Backend Development  >  How to define pi in php

How to define pi in php

(*-*)浩
(*-*)浩Original
2019-09-07 10:21:143279browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn