2019-04-08 23:22:26 +08:00

52 lines
2.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>得到圆周率值</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.pi" class="refentry">
<div class="refnamediv">
<h1 class="refname">pi</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pi</span> &mdash; <span class="dc-title">得到圆周率值</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.pi-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>pi</strong></span>
( <span class="methodparam">void</span>
) : <span class="type">float</span></div>
<p class="simpara">
返回圆周率的近似值。返回值的 <span class="type"><a href="language.types.float.html" class="type float">float</a></span>
精度是由 <var class="filename">php.ini</var> 中的 <a href="ini.core.html#ini.precision" class="link">precision</a>
指令确定。默认值是 <em>14</em>。你也可以使用
<strong><code>M_PI</code></strong> 常量,该常量产生与 <span class="function"><strong>pi()</strong></span> 完全相同的结果。
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.pi-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
圆周率pi的浮点近似值。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.pi-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4138">
<p><strong>Example #1 <span class="function"><strong>pi()</strong></span> 例子</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">pi</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;3.1415926535898<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">M_PI</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;3.1415926535898<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
</div></div></div></body></html>