<?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.parse-str.php',
    1 => 'parse_str',
    2 => 'Verarbeitet einen String als Abfrage-String einer URL',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.ord.php',
    1 => 'ord',
  ),
  'next' => 
  array (
    0 => 'function.print.php',
    1 => 'print',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/strings/functions/parse-str.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.parse-str" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">parse_str</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">parse_str</span> &mdash; <span class="dc-title">Verarbeitet einen String als Abfrage-String einer URL</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.parse-str-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>parse_str</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="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter reference">&$result</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Verarbeitet <code class="parameter">string</code>, als ob er der Query-String einer
   URL-Übergabe via GET wäre, und setzt Schlüssel im angegebenen Array
   <code class="parameter">result</code>. Wenn kein
   <code class="parameter">result</code> übergeben wurde, werden die Werte stattdessen
   als Variablen im aktuellen Geltungsbereich gesetzt.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.parse-str-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>
    
    
     <dt><code class="parameter">result</code></dt>
     <dd>
      <p class="para">
       Eine per Referenz übergebene Variable, die auf ein Array gesetzt wird,
       das die aus <code class="parameter">string</code> extrahierten
       Schlüssel-Wert-Paare enthält.
       Wenn der Parameter <code class="parameter">result</code> nicht übergeben wird,
       wird für jeden Schlüssel eine eigene Variable im lokalen Geltungsbereich
       gesetzt.
      </p>
      <div class="warning"><strong class="warning">Warnung</strong>
       <p class="para">
        Diese Funktion ohne den zweiten Parameter zu verwenden wird von
        PHP 7.2 an <em>MISSBILLIGT</em> und es wird dringend davon
        <em>ABGERATEN</em>. Von PHP 8.0.0 an ist der Parameter
        <code class="parameter">result</code> <em>zwingend erforderlich</em>.
       </p>
      </div>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.parse-str-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Es wird kein Wert zurückgegeben.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.parse-str-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>8.0.0</td>
       <td>
        <code class="parameter">result</code> ist nicht mehr optional.
       </td>
      </tr>

      <tr>
       <td>7.2.0</td>
       <td>
        Die Verwendung von <span class="function"><strong>parse_str()</strong></span> ohne den zweiten
        Parameter erzeugt nun einen <strong><code><a href="errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong>-Fehler.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.parse-str-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 Der Gebrauch von <span class="function"><strong>parse_str()</strong></span></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">"erstes=wert&amp;arr[]=foo+bar&amp;arr[]=baz"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Empfohlen<br /></span><span style="color: #0000BB">parse_str</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">$output</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">[</span><span style="color: #DD0000">'erstes'</span><span style="color: #007700">], </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// value<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">[</span><span style="color: #DD0000">'arr'</span><span style="color: #007700">][</span><span style="color: #0000BB">0</span><span style="color: #007700">], </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// foo bar<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">[</span><span style="color: #DD0000">'arr'</span><span style="color: #007700">][</span><span style="color: #0000BB">1</span><span style="color: #007700">], </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// baz<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   Bei der Erstellung von Array-Schlüsseln oder lokalen Variablen werden alle
   Leerzeichen und Punkte in Parameternamen in Unterstriche umgewandelt.
   Dies liegt daran, dass Variablennamen in PHP keine Leerzeichen oder Punkte
   enthalten dürfen. Das gilt auch, wenn diese Funktion mit dem empfohlenen
   Parameter <code class="parameter">result</code> verwendet wird.
   <div class="example" id="example-2">
    <p><strong>Beispiel #2 <span class="function"><strong>parse_str()</strong></span>-Namens-Manipulation</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />parse_str</span><span style="color: #007700">(</span><span style="color: #DD0000">"Mein Wert=Etwas"</span><span style="color: #007700">, </span><span style="color: #0000BB">$output</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">[</span><span style="color: #DD0000">'Mein_Wert'</span><span style="color: #007700">]; </span><span style="color: #FF8000">// Etwas<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.parse-str-notes">
  <h3 class="title">Anmerkungen</h3>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    <span class="function"><strong>parse_str()</strong></span> wird durch die Direktive
    <a href="info.configuration.php#ini.max-input-vars" class="link">max_input_vars</a> beeinflusst. Das
    Überschreiten dieser Grenze löst ein
    <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> aus und alle Variablen, die über diese
    Grenze hinausgehen, werden nicht zum Ergebnisarray hinzugefügt.
    Der Standardwert ist 1000;
    <a href="info.configuration.php#ini.max-input-vars" class="link">max_input_vars</a> kann nach Bedarf
    angepasst werden.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Alle Werte, die in das Array <code class="parameter">result</code> eingetragen
    werden (oder Variablen, die erstellt werden, wenn der zweite Parameter
    nicht gesetzt ist), sind bereits URL-dekodiert. Dabei gelten die gleichen
    Regeln wie bei <span class="function"><a href="function.urldecode.php" class="function">urldecode()</a></span>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Um auf den Query-String der aktuellen Anfrage zuzugreifen, kann die
    Variable <var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['QUERY_STRING']</a></var> verwendet werden.
    Weitere Informationen finden sich auch im Abschnitt
    <a href="language.variables.external.php" class="link">Variablen aus externen Quellen</a>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.parse-str-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.parse-url.php" class="function" rel="rdfs-seeAlso">parse_url()</a> - Analysiert eine URL und gibt ihre Bestandteile zur&uuml;ck</span></li>
    <li><span class="function"><a href="function.pathinfo.php" class="function" rel="rdfs-seeAlso">pathinfo()</a> - Liefert Informationen &uuml;ber einen Dateipfad</span></li>
    <li><span class="function"><a href="function.http-build-query.php" class="function" rel="rdfs-seeAlso">http_build_query()</a> - Liefert einen URL-kodierten Query-String</span></li>
    <li><span class="function"><a href="function.urldecode.php" class="function" rel="rdfs-seeAlso">urldecode()</a> - Dekodiert eine URL-kodierte Zeichenkette</span></li>
   </ul>
  </p>
 </div>


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