mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
117 lines
4.4 KiB
HTML
117 lines
4.4 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>随机打乱一个字符串</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.str-shuffle" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">str_shuffle</h1>
|
|
<p class="verinfo">(PHP 4 >= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">str_shuffle</span> — <span class="dc-title">随机打乱一个字符串</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.str-shuffle-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>str_shuffle</strong></span>
|
|
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$str</code></span>
|
|
) : <span class="type">string</span></div>
|
|
|
|
<p class="simpara">
|
|
<span class="function"><strong>str_shuffle()</strong></span> 函数打乱一个字符串,使用任何一种可能的排序方案。
|
|
</p>
|
|
<div class="caution"><strong class="caution">Caution</strong><p class="para">本函数并不会生成安全加密的值,不应用于加密用途。若需要安全加密的值,考虑使用<span class="function"><a href="openssl_random_pseudo_bytes.html" class="function">openssl_random_pseudo_bytes()</a></span>。</p></div>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.str-shuffle-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">str</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
输入字符串。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.str-shuffle-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
返回打乱后的字符串。
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.str-shuffle-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<p class="para">
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>7.1.0</td>
|
|
<td>
|
|
<a href="migration71.incompatible.html#migration71.incompatible.rand_srand_aliases" class="link">内置的随机算法从 libc rand 函数改成了<a href="http://www.math.sci.hiroshima_u.ac.jp/~m_mat/MT/emt.html" class="link external">» 梅森旋转演</a>伪随机数发生算法。</a>
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.str-shuffle-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-5959">
|
|
<p><strong>Example #1 <span class="function"><strong>str_shuffle()</strong></span> 范例</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$str </span><span style="color: #007700">= </span><span style="color: #DD0000">'abcdef'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$shuffled </span><span style="color: #007700">= </span><span style="color: #0000BB">str_shuffle</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 输出类似于: bfdaec<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$shuffled</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.str-shuffle-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="shuffle.html" class="function" rel="rdfs-seeAlso">shuffle()</a> - 打乱数组</span></li>
|
|
<li class="member"><span class="function"><a href="rand.html" class="function" rel="rdfs-seeAlso">rand()</a> - 产生一个随机整数</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |