mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 22:06:57 +08:00
100 lines
4.3 KiB
HTML
100 lines
4.3 KiB
HTML
<!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>Sign of number</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.gmp-sign" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">gmp_sign</h1>
|
|
<p class="verinfo">(PHP 4 >= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">gmp_sign</span> — <span class="dc-title">Sign of number</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.gmp-sign-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>gmp_sign</strong></span>
|
|
( <span class="methodparam"><span class="type"><a href="class.gmp.html" class="type GMP">GMP</a></span> <code class="parameter">$a</code></span>
|
|
) : <span class="type">int</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Checks the sign of a number.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.gmp-sign-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">a</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Either a GMP number <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> in PHP 5.5 and earlier,
|
|
a <a href="class.gmp.html" class="classname">GMP</a> object in PHP 5.6 and later, or a numeric
|
|
string provided that it is possible to convert the latter to an
|
|
<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.gmp-sign-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns 1 if <code class="parameter">a</code> is positive,
|
|
-1 if <code class="parameter">a</code> is negative,
|
|
and 0 if <code class="parameter">a</code> is zero.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.gmp-sign-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-4102">
|
|
<p><strong>Example #1 <span class="function"><strong>gmp_sign()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// positive<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">gmp_sign</span><span style="color: #007700">(</span><span style="color: #DD0000">"500"</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// negative<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">gmp_sign</span><span style="color: #007700">(</span><span style="color: #DD0000">"-500"</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// zero<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">gmp_sign</span><span style="color: #007700">(</span><span style="color: #DD0000">"0"</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程会输出:</p></div>
|
|
<div class="example-contents screen">
|
|
<div class="cdata"><pre>
|
|
1
|
|
-1
|
|
0
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.gmp-sign-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="gmp_abs.html" class="function" rel="rdfs-seeAlso">gmp_abs()</a> - Absolute value</span></li>
|
|
<li class="member"><span class="function"><a href="abs.html" class="function" rel="rdfs-seeAlso">abs()</a> - 绝对值</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |