This commit is contained in:
fofolee
2019-04-28 19:00:34 +08:00
parent a895309fba
commit f782158fb7
4705 changed files with 471929 additions and 471947 deletions

View File

@@ -1,143 +1,143 @@
<!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.count-chars" class="refentry">
<div class="refnamediv">
<h1 class="refname">count_chars</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">count_chars</span> &mdash; <span class="dc-title">返回字符串所用字符的信息</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.count-chars-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>count_chars</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
统计 <code class="parameter">string</code>
中每个字节值0..255)出现的次数,使用多种模式返回结果。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.count-chars-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">string</code></dt>
<dd>
<p class="para">
需要统计的字符串。
</p>
</dd>
<dt>
<code class="parameter">mode</code></dt>
<dd>
<p class="para">
参见返回的值。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.count-chars-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
根据不同的 <code class="parameter">mode</code><span class="function"><strong>count_chars()</strong></span>
返回下列不同的结果:
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
0 - 以所有的每个字节值作为键名,出现次数作为值的数组。
</span>
</li>
<li class="listitem">
<span class="simpara">
1 - 与 0 相同,但只列出出现次数大于零的字节值。
</span>
</li>
<li class="listitem">
<span class="simpara">
2 - 与 0 相同,但只列出出现次数等于零的字节值。
</span>
</li>
<li class="listitem">
<span class="simpara">
3 - 返回由所有使用了的字节值组成的字符串。
</span>
</li>
<li class="listitem">
<span class="simpara">
4 - 返回由所有未使用的字节值组成的字符串。
</span>
</li>
</ul>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.count-chars-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-5897">
<p><strong>Example #1 <span class="function"><strong>count_chars()</strong></span> 示例</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Two&nbsp;Ts&nbsp;and&nbsp;one&nbsp;F."</span><span style="color: #007700">;<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">count_chars</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"There&nbsp;were&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #DD0000">&nbsp;instance(s)&nbsp;of&nbsp;\""&nbsp;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;,&nbsp;</span><span style="color: #DD0000">"\"&nbsp;in&nbsp;the&nbsp;string.\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
There were 4 instance(s) of &quot; &quot; in the string.
There were 1 instance(s) of &quot;.&quot; in the string.
There were 1 instance(s) of &quot;F&quot; in the string.
There were 2 instance(s) of &quot;T&quot; in the string.
There were 1 instance(s) of &quot;a&quot; in the string.
There were 1 instance(s) of &quot;d&quot; in the string.
There were 1 instance(s) of &quot;e&quot; in the string.
There were 2 instance(s) of &quot;n&quot; in the string.
There were 2 instance(s) of &quot;o&quot; in the string.
There were 1 instance(s) of &quot;s&quot; in the string.
There were 1 instance(s) of &quot;w&quot; in the string.
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.count-chars-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="strpos.html" class="function" rel="rdfs-seeAlso">strpos()</a> - 查找字符串首次出现的位置</span></li>
<li class="member"><span class="function"><a href="substr_count.html" class="function" rel="rdfs-seeAlso">substr_count()</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.count-chars" class="refentry">
<div class="refnamediv">
<h1 class="refname">count_chars</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">count_chars</span> &mdash; <span class="dc-title">返回字符串所用字符的信息</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.count-chars-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>count_chars</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
统计 <code class="parameter">string</code>
中每个字节值0..255)出现的次数,使用多种模式返回结果。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.count-chars-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">string</code></dt>
<dd>
<p class="para">
需要统计的字符串。
</p>
</dd>
<dt>
<code class="parameter">mode</code></dt>
<dd>
<p class="para">
参见返回的值。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.count-chars-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
根据不同的 <code class="parameter">mode</code><span class="function"><strong>count_chars()</strong></span>
返回下列不同的结果:
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
0 - 以所有的每个字节值作为键名,出现次数作为值的数组。
</span>
</li>
<li class="listitem">
<span class="simpara">
1 - 与 0 相同,但只列出出现次数大于零的字节值。
</span>
</li>
<li class="listitem">
<span class="simpara">
2 - 与 0 相同,但只列出出现次数等于零的字节值。
</span>
</li>
<li class="listitem">
<span class="simpara">
3 - 返回由所有使用了的字节值组成的字符串。
</span>
</li>
<li class="listitem">
<span class="simpara">
4 - 返回由所有未使用的字节值组成的字符串。
</span>
</li>
</ul>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.count-chars-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-5897">
<p><strong>Example #1 <span class="function"><strong>count_chars()</strong></span> 示例</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Two&nbsp;Ts&nbsp;and&nbsp;one&nbsp;F."</span><span style="color: #007700">;<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">count_chars</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"There&nbsp;were&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #DD0000">&nbsp;instance(s)&nbsp;of&nbsp;\""&nbsp;</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">chr</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;,&nbsp;</span><span style="color: #DD0000">"\"&nbsp;in&nbsp;the&nbsp;string.\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
There were 4 instance(s) of &quot; &quot; in the string.
There were 1 instance(s) of &quot;.&quot; in the string.
There were 1 instance(s) of &quot;F&quot; in the string.
There were 2 instance(s) of &quot;T&quot; in the string.
There were 1 instance(s) of &quot;a&quot; in the string.
There were 1 instance(s) of &quot;d&quot; in the string.
There were 1 instance(s) of &quot;e&quot; in the string.
There were 2 instance(s) of &quot;n&quot; in the string.
There were 2 instance(s) of &quot;o&quot; in the string.
There were 1 instance(s) of &quot;s&quot; in the string.
There were 1 instance(s) of &quot;w&quot; in the string.
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.count-chars-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="strpos.html" class="function" rel="rdfs-seeAlso">strpos()</a> - 查找字符串首次出现的位置</span></li>
<li class="member"><span class="function"><a href="substr_count.html" class="function" rel="rdfs-seeAlso">substr_count()</a> - 计算字串出现的次数</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>