<?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 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.get-html-translation-table.php',
    1 => 'get_html_translation_table',
    2 => 'Возвращает таблицу преобразований, используемую функциями htmlspecialchars и htmlentities',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'Функции для работы со строками',
  ),
  'prev' => 
  array (
    0 => 'function.fprintf.php',
    1 => 'fprintf',
  ),
  'next' => 
  array (
    0 => 'function.hebrev.php',
    1 => 'hebrev',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/strings/functions/get-html-translation-table.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.get-html-translation-table" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_html_translation_table</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">get_html_translation_table</span> &mdash; <span class="dc-title">Возвращает таблицу преобразований, используемую функциями <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> и <span class="function"><a href="function.htmlentities.php" class="function">htmlentities()</a></span></span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.get-html-translation-table-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>get_html_translation_table</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$table</code><span class="initializer"> = <strong><code><a href="string.constants.php#constant.html-specialchars">HTML_SPECIALCHARS</a></code></strong></span></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"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$encoding</code><span class="initializer"> = &quot;UTF-8&quot;</span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>get_html_translation_table()</strong></span> возвращает таблицу
   преобразований, используемую функциями <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>
   и <span class="function"><a href="function.htmlentities.php" class="function">htmlentities()</a></span>.
  </p>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <p class="para">
    Специальные символы могут быть закодированы разными способами. Например,
    <code class="literal">&quot;</code> может быть закодирован как <code class="literal">&amp;quot;</code>,
    <code class="literal">&amp;#34;</code> или <code class="literal">&amp;#x22</code>.
    <span class="function"><strong>get_html_translation_table()</strong></span> возвращает только
    формы, используемые функциями <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>
    и <span class="function"><a href="function.htmlentities.php" class="function">htmlentities()</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.get-html-translation-table-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">table</code></dt>
     <dd>
      <p class="para">
       Указывает, какую таблицу использовать для преобразований. Либо <strong><code><a href="string.constants.php#constant.html-entities">HTML_ENTITIES</a></code></strong>, либо
       <strong><code><a href="string.constants.php#constant.html-specialchars">HTML_SPECIALCHARS</a></code></strong>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       Битовая маска, состоящая из одного или нескольких перечисленных ниже флагов, которые указывают,
       какие кавычки будет содержать таблица, а также для какого документа таблица предназначена. Значение
       по умолчанию <code class="literal">ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401</code>.
       <table class="doctable table">
        <caption><strong>Доступные константы в параметре <code class="parameter">flags</code></strong></caption>
        
         <thead>
          <tr>
           <th>Имя константы</th>
           <th>Описание</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>Таблица будет содержать сущности для двойных кавычек, но не будет для одинарных.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong></td>
           <td>Таблица будет содержать сущности как для двойных кавычек, так и для одинарных.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-noquotes">ENT_NOQUOTES</a></code></strong></td>
           <td>Таблица не будет содержать сущности ни для двойных кавычек, ни для одинарных.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-substitute">ENT_SUBSTITUTE</a></code></strong></td>
           <td>
            Заменяет некорректные кодовые последовательности символом замены
            Юникода U+FFFD в случае использования UTF-8 и
            &amp;#FFFD; при использовании другой кодировки, вместо возврата
            пустой строки.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-html401">ENT_HTML401</a></code></strong></td>
           <td>Таблица для HTML 4.01.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-xml1">ENT_XML1</a></code></strong></td>
           <td>Таблица для XML 1.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-xhtml">ENT_XHTML</a></code></strong></td>
           <td>Таблица для XHTML.</td>
          </tr>

          <tr>
           <td><strong><code><a href="string.constants.php#constant.ent-html5">ENT_HTML5</a></code></strong></td>
           <td>Таблица для HTML 5.</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       Используемая кодировка.
       Если не указана, то значением по умолчанию для этого аргумента является UTF-8.
      </p>
      


<p class="para">
 Функция поддерживает следующие кодировки:
 <table class="doctable table">
  <caption><strong>Кодировки, которые поддерживает функция</strong></caption>
  
   <thead>
    <tr>
     <th>Кодировка</th>
     <th>Псевдонимы</th>
     <th>Описание</th>
    </tr>

   </thead>

   <tbody class="tbody">
    <tr>
     <td>ISO-8859-1</td>
     <td>ISO8859-1</td>
     <td>
      Западно-Европейская кодировка с набором символов Latin-1.
     </td>
    </tr>

    <tr>
     <td>ISO-8859-5</td>
     <td>ISO8859-5</td>
     <td>
      Кириллическая кодировка с набором символов Latin/Cyrillic; применяют редко.
     </td>
    </tr>

    <tr>
     <td>ISO-8859-15</td>
     <td>ISO8859-15</td>
     <td>
      Западно-Европейская кодировка с набором символов Latin-9.
      Добавляет к набору символов Latin-1 кодировки ISO-8859-1
      знак евро, французские и финские буквы.
     </td>
    </tr>

    <tr>
     <td>UTF-8</td>
     <td class="empty">&nbsp;</td>
     <td>
      ASCII-совместимая многобайтовая 8-битная кодировка Unicode.
     </td>
    </tr>

    <tr>
     <td>cp866</td>
     <td>ibm866, 866</td>
     <td>
      Кириллическая кодировка, которую применяют в семействе операционных систем DOS.
     </td>
    </tr>

    <tr>
     <td>cp1251</td>
     <td>Windows-1251, win-1251, 1251</td>
     <td>
      Кириллическая кодировка, которую применяют
      в операционных системах Windows.
     </td>
    </tr>

    <tr>
     <td>cp1252</td>
     <td>Windows-1252, 1252</td>
     <td>
      Западно-Европейская кодировка, которую применяют
      в операционных системах Windows.
     </td>
    </tr>

    <tr>
     <td>KOI8-R</td>
     <td>koi8-ru, koi8r</td>
     <td>
      Русская кодировка.
     </td>
    </tr>

    <tr>
     <td>BIG5</td>
     <td>950</td>
     <td>
      Кодировка с набором символов Traditional Chinese (Традиционный китайский),
      которую применяют в основном на Тайване.
     </td>
    </tr>

    <tr>
     <td>GB2312</td>
     <td>936</td>
     <td>
      Стандартная национальная кодировка с набором символов
      Simplified Chinese (Упрощённый китайский).
     </td>
    </tr>

    <tr>
     <td>BIG5-HKSCS</td>
     <td class="empty">&nbsp;</td>
     <td>
      Кодировка Big5 с расширениями для Гонконга с набором символов
      Traditional Chinese (Традиционный китайский).
     </td>
    </tr>

    <tr>
     <td>Shift_JIS</td>
     <td>SJIS, SJIS-win, cp932, 932</td>
     <td>
      Японская кодировка.
     </td>
    </tr>

    <tr>
     <td>EUC-JP</td>
     <td>EUCJP, eucJP-win</td>
     <td>
      Японская кодировка.
     </td>
    </tr>

    <tr>
     <td>MacRoman</td>
     <td class="empty">&nbsp;</td>
     <td>
      Кодировка, которую использовала операционная система Mac OS.
     </td>
    </tr>

    <tr>
     <td><code class="literal">&#039;&#039;</code></td>
     <td class="empty">&nbsp;</td>
     <td>
      Пустая строка активирует режим определения кодировки из файла
      скрипта (Zend multibyte),
      директивы <a href="ini.core.php#ini.default-charset" class="link">default_charset</a>
      и текущей локали (смотрите описание функций <span class="function"><a href="function.nl-langinfo.php" class="function">nl_langinfo()</a></span>
      и <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span>), в перечисленном порядке.
      Не рекомендуется использовать.
     </td>
    </tr>

   </tbody>
  
 </table>

 <blockquote class="note"><p><strong class="note">Замечание</strong>: 
  <span class="simpara">
   Другие кодировки функция не распознаёт. Вместо других кодировок
   функция будет использовать кодировку по умолчанию и выдаст предупреждение.
  </span>
 </p></blockquote>
</p>

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


 <div class="refsect1 returnvalues" id="refsect1-function.get-html-translation-table-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Возвращает таблицу преобразований в виде массива с оригинальными символами в качестве
   ключей и сущностями в качестве значений.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.get-html-translation-table-changelog">
  <h3 class="title">Список изменений</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версия</th>
      <th>Описание</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.1.0</td>
      <td>
       Значение по умолчанию параметра <code class="parameter">flags</code> изменено с <strong><code><a href="string.constants.php#constant.ent-compat">ENT_COMPAT</a></code></strong> на <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>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.get-html-translation-table-examples">
  <h3 class="title">Примеры</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Пример #1 Пример таблицы преобразований</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_html_translation_table</span><span style="color: #007700">(</span><span style="color: #0000BB">HTML_ENTITIES</span><span style="color: #007700">, </span><span style="color: #0000BB">ENT_QUOTES </span><span style="color: #007700">| </span><span style="color: #0000BB">ENT_HTML5</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    
<div class="example-contents"><p>
 Вывод приведённого примера будет похож на:
</p></div>

    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">array(1510) {
  [&quot;
&quot;]=&gt;
  string(9) &quot;&amp;NewLine;&quot;
  [&quot;!&quot;]=&gt;
  string(6) &quot;&amp;excl;&quot;
  [&quot;&quot;&quot;]=&gt;
  string(6) &quot;&amp;quot;&quot;
  [&quot;#&quot;]=&gt;
  string(5) &quot;&amp;num;&quot;
  [&quot;$&quot;]=&gt;
  string(8) &quot;&amp;dollar;&quot;
  [&quot;%&quot;]=&gt;
  string(8) &quot;&amp;percnt;&quot;
  [&quot;&amp;&quot;]=&gt;
  string(5) &quot;&amp;amp;&quot;
  [&quot;&#039;&quot;]=&gt;
  string(6) &quot;&amp;apos;&quot;
  // ...
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.get-html-translation-table-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.htmlspecialchars.php" class="function" rel="rdfs-seeAlso">htmlspecialchars()</a> - Преобразовывает специальные символы в HTML-сущности</span></li>
    <li><span class="function"><a href="function.htmlentities.php" class="function" rel="rdfs-seeAlso">htmlentities()</a> - Преобразовывает возможные символы в HTML-сущности</span></li>
    <li><span class="function"><a href="function.html-entity-decode.php" class="function" rel="rdfs-seeAlso">html_entity_decode()</a> - Преобразовывает HTML-сущности в символы</span></li>
   </ul>
  </p>
 </div>


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