<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.str-shuffle.php',
    1 => 'str_shuffle',
    2 => 'Mischt einen String nach dem Zufallsprinzip',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String-Funktionen',
  ),
  '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' => 'de',
    '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">Mischt einen String nach dem Zufallsprinzip</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.str-shuffle-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <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> mischt eine Zeichenkette. Es entsteht eine
   Permutation aller vorhandenen Zeichen.
  </p>
  <div class="caution"><strong class="caution">Achtung</strong>
 <p class="para">
  Diese Funktion erzeugt keine kryptografisch sicheren Werte und
  <em>darf nicht</em> für kryptografische Zwecke verwendet werden
  oder für Zwecke, bei denen die zurückgegebenen Werte nicht abschätzbar sein
  dürfen.
 </p>
 <p class="para">
  Falls kryptographisch sichere Zufallszahlen benötigt werden, kann der
  <span class="classname"><a href="class.random-randomizer.php" class="classname">Random\Randomizer</a></span> mit der
  <span class="classname"><a href="class.random-engine-secure.php" class="classname">Random\Engine\Secure</a></span>-Engine verwendet werden. Für
  einfache Anwendungsfälle bieten die Funktionen <span class="function"><a href="function.random-int.php" class="function">random_int()</a></span>
  und <span class="function"><a href="function.random-bytes.php" class="function">random_bytes()</a></span> eine bequeme und sichere
  <abbr title="Application Programming Interface">API</abbr>, die den <abbr title="Cryptographically Secure PseudoRandom Number Generator">CSPRNG</abbr> des
  Betriebssystems verwendet.
 </p>
</div>
  <div class="caution"><strong class="caution">Achtung</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">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       Die Eingabezeichenkette.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.str-shuffle-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt die vermischte Zeichenkette zurück.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.str-shuffle-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Beschreibung</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.1.0</td>
       <td>
        Der interne Zufallsalgorithmus <a href="migration71.incompatible.php#migration71.incompatible.rand-srand-aliases" class="link">wurde
        geändert</a>, und verwendet nun den <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html" class="link external">&raquo;&nbsp;Mersenne Twister</a>
        Zufallszahlengenerator statt der rand Funktion von libc.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.str-shuffle-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>str_shuffle()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?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">// erzeugt eine Ausgabe wie: 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">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.str-shuffle-seealso">
  <h3 class="title">Siehe auch</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); ?>