mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-11 08:53:20 +08:00
v0.0.2
This commit is contained in:
@@ -1,125 +1,125 @@
|
||||
<!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.base-convert" class="refentry">
|
||||
<div class="refnamediv">
|
||||
<h1 class="refname">base_convert</h1>
|
||||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">base_convert</span> — <span class="dc-title">在任意进制之间转换数字</span></p>
|
||||
|
||||
</div>
|
||||
<div class="refsect1 description" id="refsect1-function.base-convert-description">
|
||||
<h3 class="title">说明</h3>
|
||||
<div class="methodsynopsis dc-description">
|
||||
<span class="methodname"><strong>base_convert</strong></span>
|
||||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$number</code></span>
|
||||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$frombase</code></span>
|
||||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$tobase</code></span>
|
||||
) : <span class="type">string</span></div>
|
||||
|
||||
<p class="para rdfs-comment">
|
||||
返回一字符串,包含 <code class="parameter">number</code>
|
||||
以 <code class="parameter">tobase</code> 进制的表示。<code class="parameter">number</code>
|
||||
本身的进制由
|
||||
<code class="parameter">frombase</code> 指定。<code class="parameter">frombase</code>
|
||||
和 <code class="parameter">tobase</code> 都只能在
|
||||
2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如
|
||||
a 表示 10,b 表示 11 以及 z 表示 35。
|
||||
</p>
|
||||
<div class="warning"><strong class="warning">Warning</strong>
|
||||
<p class="simpara">
|
||||
由于使用内部的 "double" 或 "float" 类型,<span class="function"><strong>base_convert()</strong></span>
|
||||
的操作可能会导致大数值中的精度丢失。请参见本手册的
|
||||
<a href="language.types.float.html" class="link">浮点数</a> 章节以便获得更多详细信息。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 parameters" id="refsect1-function.base-convert-parameters">
|
||||
<h3 class="title">参数</h3>
|
||||
<p class="para">
|
||||
<dl>
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">number</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
要转换的数字
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">frombase</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
The base <code class="parameter">number</code> is in
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">tobase</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
The base to convert <code class="parameter">number</code> to
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 returnvalues" id="refsect1-function.base-convert-returnvalues">
|
||||
<h3 class="title">返回值</h3>
|
||||
<p class="para">
|
||||
<code class="parameter">number</code> converted to base <code class="parameter">tobase</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 examples" id="refsect1-function.base-convert-examples">
|
||||
<h3 class="title">范例</h3>
|
||||
<p class="para">
|
||||
<div class="example" id="example-4116">
|
||||
<p><strong>Example #1 <span class="function"><strong>base_convert()</strong></span> 例子</strong></p>
|
||||
<div class="example-contents">
|
||||
<div class="phpcode"><pre><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br />$hexadecimal </span><span style="color: #007700">= </span><span style="color: #DD0000">'A37334'</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">base_convert</span><span style="color: #007700">(</span><span style="color: #0000BB">$hexadecimal</span><span style="color: #007700">, </span><span style="color: #0000BB">16</span><span style="color: #007700">, </span><span style="color: #0000BB">2</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>
|
||||
101000110111001100110100
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 seealso" id="refsect1-function.base-convert-seealso">
|
||||
<h3 class="title">参见</h3>
|
||||
<p class="para">
|
||||
<ul class="simplelist">
|
||||
<li class="member"><span class="function"><a href="intval.html" class="function" rel="rdfs-seeAlso">intval()</a> - 获取变量的整数值</span></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!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.base-convert" class="refentry">
|
||||
<div class="refnamediv">
|
||||
<h1 class="refname">base_convert</h1>
|
||||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">base_convert</span> — <span class="dc-title">在任意进制之间转换数字</span></p>
|
||||
|
||||
</div>
|
||||
<div class="refsect1 description" id="refsect1-function.base-convert-description">
|
||||
<h3 class="title">说明</h3>
|
||||
<div class="methodsynopsis dc-description">
|
||||
<span class="methodname"><strong>base_convert</strong></span>
|
||||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$number</code></span>
|
||||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$frombase</code></span>
|
||||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$tobase</code></span>
|
||||
) : <span class="type">string</span></div>
|
||||
|
||||
<p class="para rdfs-comment">
|
||||
返回一字符串,包含 <code class="parameter">number</code>
|
||||
以 <code class="parameter">tobase</code> 进制的表示。<code class="parameter">number</code>
|
||||
本身的进制由
|
||||
<code class="parameter">frombase</code> 指定。<code class="parameter">frombase</code>
|
||||
和 <code class="parameter">tobase</code> 都只能在
|
||||
2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如
|
||||
a 表示 10,b 表示 11 以及 z 表示 35。
|
||||
</p>
|
||||
<div class="warning"><strong class="warning">Warning</strong>
|
||||
<p class="simpara">
|
||||
由于使用内部的 "double" 或 "float" 类型,<span class="function"><strong>base_convert()</strong></span>
|
||||
的操作可能会导致大数值中的精度丢失。请参见本手册的
|
||||
<a href="language.types.float.html" class="link">浮点数</a> 章节以便获得更多详细信息。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 parameters" id="refsect1-function.base-convert-parameters">
|
||||
<h3 class="title">参数</h3>
|
||||
<p class="para">
|
||||
<dl>
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">number</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
要转换的数字
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">frombase</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
The base <code class="parameter">number</code> is in
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">tobase</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
The base to convert <code class="parameter">number</code> to
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 returnvalues" id="refsect1-function.base-convert-returnvalues">
|
||||
<h3 class="title">返回值</h3>
|
||||
<p class="para">
|
||||
<code class="parameter">number</code> converted to base <code class="parameter">tobase</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 examples" id="refsect1-function.base-convert-examples">
|
||||
<h3 class="title">范例</h3>
|
||||
<p class="para">
|
||||
<div class="example" id="example-4116">
|
||||
<p><strong>Example #1 <span class="function"><strong>base_convert()</strong></span> 例子</strong></p>
|
||||
<div class="example-contents">
|
||||
<div class="phpcode"><pre><span style="color: #000000">
|
||||
<span style="color: #0000BB"><?php<br />$hexadecimal </span><span style="color: #007700">= </span><span style="color: #DD0000">'A37334'</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">base_convert</span><span style="color: #007700">(</span><span style="color: #0000BB">$hexadecimal</span><span style="color: #007700">, </span><span style="color: #0000BB">16</span><span style="color: #007700">, </span><span style="color: #0000BB">2</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>
|
||||
101000110111001100110100
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="refsect1 seealso" id="refsect1-function.base-convert-seealso">
|
||||
<h3 class="title">参见</h3>
|
||||
<p class="para">
|
||||
<ul class="simplelist">
|
||||
<li class="member"><span class="function"><a href="intval.html" class="function" rel="rdfs-seeAlso">intval()</a> - 获取变量的整数值</span></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div></div></div></body></html>
|
Reference in New Issue
Block a user