<?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.html-entity-decode.php',
    1 => 'html_entity_decode',
    2 => 'Wandelt HTML-Entities in ihre entsprechenden Zeichen um',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.hex2bin.php',
    1 => 'hex2bin',
  ),
  'next' => 
  array (
    0 => 'function.htmlentities.php',
    1 => 'htmlentities',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/strings/functions/html-entity-decode.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.html-entity-decode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">html_entity_decode</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">html_entity_decode</span> &mdash; <span class="dc-title">Wandelt HTML-Entities in ihre entsprechenden Zeichen um</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.html-entity-decode-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>html_entity_decode</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.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401</span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>html_entity_decode()</strong></span> ist das Gegenstück zu
   <span class="function"><a href="function.htmlentities.php" class="function">htmlentities()</a></span>, welches HTML-Entities innerhalb von
   <code class="parameter">string</code> in ihre entsprechenden Zeichen zurückwandelt.
  </p>
  <p class="para">
   Genau gesagt dekodiert diese Funktion alle Entities (einschließlich aller
   numerischen Entities), die a) auf jeden Fall gültig für den gewählten
   Dokumenttyp sind — d. h. für XML dekodiert diese Funktion keine benannten
   Entities, die in einer DTD definiert sein könnten — und b) deren Zeichen in
   der Zeichenkodierung und im gewählten Dokumenttyp erlaubt sind. Alle
   anderen Entities bleiben wie sie sind.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.html-entity-decode-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">flags</code></dt>
     <dd>
      <p class="para">
       Eine Bitmaske von einem oder mehreren der folgenden Flags, die die
       Behandlung von Anführungszeichen sowie den zu nutzenden Dokumententyp
       festlegen. Der Standardwert ist <code class="literal">ENT_QUOTES | ENT_SUBSTITUTE |
       ENT_HTML401</code>.
       <table class="doctable table">
        <caption><strong>Verfügbare <code class="parameter">flags</code>-Konstanten</strong></caption>
        
         <thead>
          <tr>
           <th>Name der Konstante</th>
           <th>Beschreibung</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-compat">ENT_COMPAT</a></code></strong></td>
           <td>
            Wandelt doppelte Anführungszeichen um und lässt einfache
            Anführungszeichen unverändert.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong></td>
           <td>
            Wandelt sowohl doppelte als auch einfache Anführungszeichen um.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-noquotes">ENT_NOQUOTES</a></code></strong></td>
           <td>
            Lässt sowohl doppelte als auch einfache Anführungszeichen
            unverändert.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-substitute">ENT_SUBSTITUTE</a></code></strong></td>
           <td>
            Ersetzt ungültige Code-Unit-Sequenzen mit dem
            Unicode-Ersatzzeichen U+FFFD (UTF-8) oder &amp;#xFFFD;
            (andernfalls), anstatt eine leere Zeichenkette zurückzugeben.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-html401">ENT_HTML401</a></code></strong></td>
           <td>
            Behandle Code als HTML 4.01.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-xml1">ENT_XML1</a></code></strong></td>
           <td>
            Behandle Code als XML 1.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-xhtml">ENT_XHTML</a></code></strong></td>
           <td>
            Behandle Code als XHTML.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-html5">ENT_HTML5</a></code></strong></td>
           <td>
            Behandle Code als HTML 5.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      
 <p class="para">
  Ein optionaler Parameter, der die Zeichenkodierung für eine Konvertierung
  definiert.
 </p>
 <p class="para">
  Wird der Parameter <code class="parameter">encoding</code> ausgelassen, so wird
  der Wert der Konfigurationsoption
  <a href="ini.core.php#ini.default-charset" class="link">default_charset</a> als Standardwert
  dafür verwendet.
 </p>
 <p class="para">
  Obwohl dieser Parameter technisch gesehen optional ist, wird dringend
  empfohlen, den korrekten Wert für den jeweiligen Code anzugeben, falls die
  Konfigurationsoption
  <a href="ini.core.php#ini.default-charset" class="link">default_charset</a> für die jeweilige
  Eingabe möglicherweise falsch gesetzt ist.
 </p>

      


<p class="para">
 Die folgenden Zeichensätze werden unterstützt:
 <table class="doctable table">
  <caption><strong>Unterstützte Zeichensätze</strong></caption>
  
   <thead>
    <tr>
     <th>Zeichensatz</th>
     <th>Alias</th>
     <th>Beschreibung</th>
    </tr>

   </thead>

   <tbody class="tbody">
    <tr>
     <td>ISO-8859-1</td>
     <td>ISO8859-1</td>
     <td>
      Westeuropäisch, Latin-1.
     </td>
    </tr>

    <tr>
     <td>ISO-8859-5</td>
     <td>ISO8859-5</td>
     <td>
      Wenig verwendeter kyrillischer Zeichensatz (Latin/Cyrillic).
     </td>
    </tr>

    <tr>
     <td>ISO-8859-15</td>
     <td>ISO8859-15</td>
     <td>
      Westeuropäisch, Latin-9. Enthält das Euro-Zeichen sowie französische
      und finnische Buchstaben, die in Latin-1(ISO-8859-1) fehlen.
     </td>
    </tr>

    <tr>
     <td>UTF-8</td>
     <td class="empty">&nbsp;</td>
     <td>
      ASCII-kompatibles Multi-Byte 8-Bit Unicode.
     </td>
    </tr>

    <tr>
     <td>cp866</td>
     <td>ibm866, 866</td>
     <td>
      DOS-spezifischer kyrillischer Zeichensatz.
     </td>
    </tr>

    <tr>
     <td>cp1251</td>
     <td>Windows-1251, win-1251, 1251</td>
     <td>
      Windows-spezifischer kyrillischer Zeichensatz.
     </td>
    </tr>

    <tr>
     <td>cp1252</td>
     <td>Windows-1252, 1252</td>
     <td>
      Windows spezifischer Zeichensatz für westeuropäische Sprachen.
     </td>
    </tr>

    <tr>
     <td>KOI8-R</td>
     <td>koi8-ru, koi8r</td>
     <td>
      Russisch.
     </td>
    </tr>

    <tr>
     <td>BIG5</td>
     <td>950</td>
     <td>
      Traditionelles Chinesisch, hauptsächlich in Taiwan verwendet.
     </td>
    </tr>

    <tr>
     <td>GB2312</td>
     <td>936</td>
     <td>
      Vereinfachtes Chinesisch, nationaler Standard-Zeichensatz.
     </td>
    </tr>

    <tr>
     <td>BIG5-HKSCS</td>
     <td class="empty">&nbsp;</td>
     <td>
      Big5 mit Hongkong-spezifischen Erweiterungen; traditionelles Chinesisch.
     </td>
    </tr>

    <tr>
     <td>Shift_JIS</td>
     <td>SJIS, SJIS-win, cp932, 932</td>
     <td>
      Japanisch
     </td>
    </tr>

    <tr>
     <td>EUC-JP</td>
     <td>EUCJP, eucJP-win</td>
     <td>
      Japanisch
     </td>
    </tr>

    <tr>
     <td>MacRoman</td>
     <td class="empty">&nbsp;</td>
     <td>
      Zeichensatz, der von Mac OS verwendet wurde.
     </td>
    </tr>

    <tr>
     <td><code class="literal">&#039;&#039;</code></td>
     <td class="empty">&nbsp;</td>
     <td>
      Eine leere Zeichenkette aktiviert die Erkennung durch die Kodierung des
      Skripts (Zend multibyte),
      <a href="ini.core.php#ini.default-charset" class="link">default_charset</a> und die
      aktuelle Sprachumgebung (siehe <span class="function"><a href="function.nl-langinfo.php" class="function">nl_langinfo()</a></span> und
      <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>), in dieser Reihenfolge. Nicht
      empfehlenswert.
     </td>
    </tr>

   </tbody>
  
 </table>

 <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
  <span class="simpara">
   Weitere Zeichensätze sind nicht implementiert. Statt dessen wird die
   Standard-Kodierung verwendet und eine Warnung ausgegeben.
  </span>
 </p></blockquote>
</p>


     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.html-entity-decode-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt die dekodierte Zeichenkette zurück.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.html-entity-decode-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.1.0</td>
      <td>
       <code class="parameter">flags</code> geändert von
       <strong><code><a href="string.constants.php#constant.ent-compat">ENT_COMPAT</a></code></strong> zu <strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong> |
       <strong><code><a href="string.constants.php#constant.ent-substitute">ENT_SUBSTITUTE</a></code></strong> | <strong><code><a href="string.constants.php#constant.ent-html401">ENT_HTML401</a></code></strong>.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">encoding</code> ist jetzt nullable (akzeptiert den
       <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>-Wert).
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.html-entity-decode-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 Dekodieren benannter HTML-Zeichen</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$orig </span><span style="color: #007700">= </span><span style="color: #DD0000">"I'll \"walk\" the &lt;b&gt;dog&lt;/b&gt; now"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$a </span><span style="color: #007700">= </span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$orig</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$b </span><span style="color: #007700">= </span><span style="color: #0000BB">html_entity_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// I'll &amp;quot;walk&amp;quot; the &amp;lt;b&amp;gt;dog&amp;lt;/b&amp;gt; now<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$b</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">; </span><span style="color: #FF8000">// I'll "walk" the &lt;b&gt;dog&lt;/b&gt; now<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.html-entity-decode-notes">
  <h3 class="title">Anmerkungen</h3>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Sie wundern sich vielleicht, warum trim(html_entity_decode(&#039;&amp;nbsp;&#039;));
    die Zeichenkette nicht zu einer leeren Zeichenkette reduziert. Der Grund
    dafür ist, dass &#039;&amp;nbsp;&#039; in der Standard-Kodierung nicht dem Zeichen
    mit ASCII-Code 32 entspricht (dieses wird von <span class="function"><a href="function.trim.php" class="function">trim()</a></span>
    entfernt), sondern dem Zeichen mit ASCII-Code 160 (0xa0).
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.html-entity-decode-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.htmlentities.php" class="function" rel="rdfs-seeAlso">htmlentities()</a> - Wandelt alle geeigneten Zeichen in entsprechende HTML-Entities um</span></li>
    <li><span class="function"><a href="function.htmlspecialchars.php" class="function" rel="rdfs-seeAlso">htmlspecialchars()</a> - Wandelt Sonderzeichen in HTML-Entities um</span></li>
    <li><span class="function"><a href="function.get-html-translation-table.php" class="function" rel="rdfs-seeAlso">get_html_translation_table()</a> - Liefert die Umwandlungstabelle, die von
   htmlspecialchars und htmlentities
   verwendet wird</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); ?>