<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.intl.idn.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.idn-to-ascii.php',
    1 => 'idn_to_ascii',
    2 => 'Преобразовывает доменное имя в формат ASCII по спецификации IDNA',
  ),
  'up' => 
  array (
    0 => 'ref.intl.idn.php',
    1 => 'Функции IDN',
  ),
  'prev' => 
  array (
    0 => 'ref.intl.idn.php',
    1 => 'Функции IDN',
  ),
  'next' => 
  array (
    0 => 'function.idn-to-utf8.php',
    1 => 'idn_to_utf8',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/intl/idn/idn-to-ascii.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.idn-to-ascii" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">idn_to_ascii</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.2, PECL idn &gt;= 0.1)</p><p class="refpurpose"><span class="refname">idn_to_ascii</span> &mdash; <span class="dc-title">Преобразовывает доменное имя в формат ASCII по спецификации IDNA</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.idn-to-ascii-description">
  <h3 class="title">Описание</h3>
  <p class="para">Процедурный стиль</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>idn_to_ascii</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$domain</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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"> = <strong><code><a href="intl.constants.php#constant.idna-default">IDNA_DEFAULT</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$variant</code><span class="initializer"> = <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter reference">&$idna_info</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Функция преобразовывает доменные имена в кодировке Юникод
   в формат, совместимый со стандартом ASCII, и возвращает результат в нижнем регистре.
   Доменные имена, в состав которых входят символы национальных алфавитов, обрабатываются по правилам
   механизма интернационализации доменных имён в приложениях — IDNA (англ. Internationalizing Domain Names in Applications).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.idn-to-ascii-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">domain</code></dt>
     <dd>
      <p class="para">
       Домен с символами в кодировке UTF-8, которые требуется преобразовать.
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       Опции преобразования — комбинация констант семейства IDNA_*,
       кроме констант семейства IDNA_ERROR_*.
      </p>
     </dd>
    
    
     <dt><code class="parameter">variant</code></dt>
     <dd>
      <p class="para">
       Константа <strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong> (устарела с PHP 7.2.0) для преобразования домена по правилам спецификации IDNA 2003
       или константа <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong> (доступна только с ICU 4.6) для преобразования по правилам спецификации UTS #46.
      </p>
     </dd>
    
    
     <dt><code class="parameter">idna_info</code></dt>
     <dd>
      <p class="para">
       Параметр влияет на результат только при передаче константы
       <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong> в параметр
       <code class="parameter">variant</code>. Функция заполнит переменную
       массивом с ключами <code class="literal">&#039;result&#039;</code> — домен в ASCII-формате,
       возможно, с ошибками преобразования, <code class="literal">&#039;isTransitionalDifferent&#039;</code> —
       логическое значение, которое указывает, повлиял ли переходный механизм протокола UTS #46 на результат или мог бы повлиять,
       и <code class="literal">&#039;errors&#039;</code> — значение <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>, которое представляет битовую маску из констант
       семейства IDNA_ERROR_*.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.idn-to-ascii-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Функция возвращает доменное имя, закодированное в формате, совместимом со стандартом ASCII, или <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, если возникла ошибка.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.idn-to-ascii-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.4.0</td>
       <td>
        Значением по умолчанию для параметра <code class="parameter">variant</code>
        стала константа <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong> вместо устаревшего
        варианта <strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong>.
       </td>
      </tr>

      <tr>
       <td>7.2.0</td>
       <td>
        Константа <strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong> устарела
        в пользу варианта <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.idn-to-ascii-examples">
  <h3 class="title">Примеры</h3>
  <div class="example" id="example-1">
   <p><strong>Пример #1 Пример преобразования национального доменного имени функцией <span class="function"><strong>idn_to_ascii()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">idn_to_ascii</span><span style="color: #007700">(</span><span style="color: #DD0000">'täst.de'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
  
<p class="para">
 Результат выполнения приведённого примера:
</p>

  <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">xn--tst-qla.de</pre>
</div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Пример #2 Пример обработки доменного имени, которое состоит только из ASCII-символов</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// ASCII-домены функция только приводит к нижнему регистру<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">idn_to_ascii</span><span style="color: #007700">(</span><span style="color: #DD0000">'Example.com'</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
  
<p class="para">
 Результат выполнения приведённого примера:
</p>

  <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">string(11) &quot;example.com&quot;</pre>
</div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.idn-to-ascii-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.idn-to-utf8.php" class="function" rel="rdfs-seeAlso">idn_to_utf8()</a> - Преобразование доменного имени из IDNA ASCII в Unicode</span></li>
   </ul>
  </p>
 </div>

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