<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.str-shuffle.php',
    1 => 'str_shuffle',
    2 => 'Randomly shuffles a string',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Функції',
  ),
  'prev' => 
  array (
    0 => 'function.str-rot13.php',
    1 => 'str_rot13',
  ),
  'next' => 
  array (
    0 => 'function.str-split.php',
    1 => 'str_split',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/strings/functions/str-shuffle.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.str-shuffle" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">str_shuffle</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">str_shuffle</span> &mdash; <span class="dc-title">Randomly shuffles a string</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.str-shuffle-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>str_shuffle</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="simpara">
   <span class="function"><strong>str_shuffle()</strong></span> shuffles a string.  One permutation
   of all possible is created.
  </p>
  <div class="caution"><strong class="caution">Застереження</strong>
 <p class="para">
  Ця функція не генерує криптографічно безпечні значення, тож <em>не
  повинна</em> використовуватись для криптографічних цілей чи тих, що
  вимагають використання непередбачуваних значень.
 </p>
 <p class="para">
  Якщо потрібна криптографічно безпечна випадковість, можна використати
  <span class="classname"><a href="class.random-randomizer.php" class="classname">Random\Randomizer</a></span> разом з рушієм
  <span class="classname"><a href="class.random-engine-secure.php" class="classname">Random\Engine\Secure</a></span>. Для простих випадків є функції
  <span class="function"><a href="function.random-int.php" class="function">random_int()</a></span> і <span class="function"><a href="function.random-bytes.php" class="function">random_bytes()</a></span>, які
  забезпечують зручний і безпечний <abbr title="Application Programming Interface">API</abbr> до системного
  <abbr title="Cryptographically Secure Pseudorandom Number Generator">CSPRNG</abbr>.
 </p>
</div>
  <div class="caution"><strong class="caution">Застереження</strong>
 <p class="simpara">
    This function uses the global Mt19937 (“Mersenne Twister”) instance as the source of randomness and thus shares its state with all other functions using the global Mt19937.
    Using any of these functions advances the sequence for <em>all</em> the other functions, regardless of scope.
  </p>
  <p class="simpara">
    Generating repeatable sequences by seeding <span class="function"><a href="function.mt-srand.php" class="function">mt_srand()</a></span> or <span class="function"><a href="function.srand.php" class="function">srand()</a></span> with a known value will also yield repeatable output from this function.
  </p>
  <p class="simpara">
    Prefer using <span class="classname"><a href="class.random-randomizer.php" class="classname">Random\Randomizer</a></span> methods in all newly written code.
 </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">string</code></dt>
     <dd>
      <p class="para">
       The input string.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.str-shuffle-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns the shuffled string.
  </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>
        The internal randomization algorithm <a href="migration71.incompatible.php#migration71.incompatible.rand-srand-aliases" class="link">has been changed</a> to use the <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html" class="link external">&raquo;&nbsp;Mersenne Twister</a> Random Number Generator instead of the libc rand function.
       </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-1">
    <p><strong>Приклад #1 <span class="function"><strong>str_shuffle()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$str </span><span style="color: #007700">= </span><span style="color: #DD0000">'abcdef'</span><span style="color: #007700">;
</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">);

</span><span style="color: #FF8000">// This will echo something like: bfdaec
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$shuffled</span><span style="color: #007700">;
</span><span style="color: #0000BB">?&gt;</span></code></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><span class="function"><a href="random-randomizer.shufflebytes.php" class="function" rel="rdfs-seeAlso">Random\Randomizer::shuffleBytes()</a> - Get a byte-wise permutation of a string</span></li>
    <li><span class="function"><a href="random-randomizer.shufflearray.php" class="function" rel="rdfs-seeAlso">Random\Randomizer::shuffleArray()</a> - Get a permutation of an array</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>