<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.mb-check-encoding.php',
    1 => 'mb_check_encoding',
    2 => 'Проверяет, допустима ли строка для заданной кодировки',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Функции для работы с многобайтовыми строками',
  ),
  'prev' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Функции для работы с многобайтовыми строками',
  ),
  'next' => 
  array (
    0 => 'function.mb-chr.php',
    1 => 'mb_chr',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/mbstring/functions/mb-check-encoding.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-check-encoding" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_check_encoding</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.4.3, PHP 5 &gt;= 5.1.3, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_check_encoding</span> &mdash; <span class="dc-title">Проверяет, допустима ли строка для заданной кодировки</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mb-check-encoding-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_check_encoding</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$value</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></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.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Проверяет, допустим ли заданный поток байтов для заданной кодировки.
   Если значение параметра <code class="parameter">value</code> — массив (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>), то все ключи и значения
   проверяются рекурсивно.
   Функция полезна для предотвращения атаки, которая называется «Атака
   неправильной кодировкой».
  </p>
  <p class="para">
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-check-encoding-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       Поток байтов или массив (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>) для проверки. Если не задан, функция проверит все входные
       данные с начала запроса.
      </p>

      <div class="warning"><strong class="warning">Внимание</strong>
       <p class="para">
        Начиная с PHP 8.1.0 пропуск этого параметра или передача значения <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> устарели.
       </p>
      </div>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       Ожидаемая кодировка.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


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


 <div class="refsect1 changelog" id="refsect1-function.mb-check-encoding-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>
       Вызов функции с <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> в качестве параметра <code class="parameter">value</code> или без аргумента устарело.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       Параметры <code class="parameter">value</code> и <code class="parameter">encoding</code> могут
       принимать значение <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>.
      </td>
     </tr>

     <tr>
      <td>7.2.0</td>
      <td>
       Функция теперь также принимает массив (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>) в <code class="parameter">value</code>.
       Ранее поддерживались только строки (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>).
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


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