<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.iconv.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.iconv-substr.php',
    1 => 'iconv_substr',
    2 => 'Получение части строки',
  ),
  'up' => 
  array (
    0 => 'ref.iconv.php',
    1 => 'Функции iconv',
  ),
  'prev' => 
  array (
    0 => 'function.iconv-strrpos.php',
    1 => 'iconv_strrpos',
  ),
  'next' => 
  array (
    0 => 'function.ob-iconv-handler.php',
    1 => 'ob_iconv_handler',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/iconv/functions/iconv-substr.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.iconv-substr" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">iconv_substr</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">iconv_substr</span> &mdash; <span class="dc-title">Получение части строки</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.iconv-substr-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>iconv_substr</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">$string</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">$offset</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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.integer.php" class="type int">int</a></span></span> <code class="parameter">$length</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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><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">
   Получает часть строки <code class="parameter">string</code>, определённую
   параметрами <code class="parameter">offset</code> и <code class="parameter">length</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.iconv-substr-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       Изначальная строка.
      </p>
     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       Если <code class="parameter">offset</code> неотрицателен,
       <span class="function"><strong>iconv_substr()</strong></span> получает часть строки
       <code class="parameter">string</code> начиная с символа с порядковым номером
       <code class="parameter">offset</code> (нумерация начинается с нуля).
      </p>
      <p class="para">
       Если <code class="parameter">offset</code> отрицателен,
       <span class="function"><strong>iconv_substr()</strong></span> получает часть строки
       начиная с позиции, отстоящую от конца строки
       <code class="parameter">string</code> на <code class="parameter">offset</code>
       символов.
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       Если <code class="parameter">length</code> задан и положителен, возвращаемое
       значение содержит не более <code class="parameter">length</code> символов,
       начиная с <code class="parameter">offset</code> (зависит от длины строки
       <code class="parameter">string</code>).
      </p>
      <p class="para">
       Если указан отрицательный <code class="parameter">length</code>,
       <span class="function"><strong>iconv_substr()</strong></span> получает часть строки
       <code class="parameter">string</code>, начиная с <code class="parameter">offset</code>
       символа и до символа, отстоящего от конца строки на
       <code class="parameter">length</code> символов.
       В случае, если <code class="parameter">offset</code> также отрицателен,
       стартовая позиция вычисляется заранее в соответствии с
       вышеописанным правилом.
      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       Если параметр <code class="parameter">encoding</code> не указан,
       предполагается, что строка <code class="parameter">string</code>
       имеет кодировку
       <a href="iconv.configuration.php" class="link">iconv.internal_encoding</a>.
      </p>
      <p class="para">
       Обратите внимание, что и <code class="parameter">offset</code>,
       и <code class="parameter">length</code> основываются на размере символа,
       рассчитанного исходя из кодировки текста (<code class="parameter">encoding</code>),
       в то время как схожая функция <span class="function"><a href="function.substr.php" class="function">substr()</a></span>
       всегда рассматривает их побайтовое смещение.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.iconv-substr-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Возвращает часть строки <code class="parameter">string</code>, определённую
   параметрами <code class="parameter">offset</code> и <code class="parameter">length</code>.
  </p>
  <p class="para">
   Если строка <code class="parameter">string</code> имеет меньшую длину, чем
   параметр <code class="parameter">offset</code>, будет возвращено
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
   Если <code class="parameter">string</code> имеет длину равную <code class="parameter">offset</code>,
   будет возвращена пустая строка.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.iconv-substr-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>8.0.0</td>
      <td>
       <code class="parameter">length</code> и <code class="parameter">encoding</code> теперь допускают значение null.
      </td>
     </tr>

       <tr>
        <td>7.0.11</td>
        <td>
         Если <code class="parameter">string</code> имеет длину равную <code class="parameter">offset</code>,
         будет возвращена пустая строка. Ранее в подобных случаях возвращалось <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.iconv-substr-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.substr.php" class="function" rel="rdfs-seeAlso">substr()</a> - Возвращает подстроку</span></li>
    <li><span class="function"><a href="function.mb-substr.php" class="function" rel="rdfs-seeAlso">mb_substr()</a> - Возвращает часть строки</span></li>
    <li><span class="function"><a href="function.mb-strcut.php" class="function" rel="rdfs-seeAlso">mb_strcut()</a> - Получает часть строки</span></li>
   </ul>
  </p>
 </div>


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