<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.intl.grapheme.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.grapheme-substr.php',
    1 => 'grapheme_substr',
    2 => 'Return part of a string',
  ),
  'up' => 
  array (
    0 => 'ref.intl.grapheme.php',
    1 => 'Функції Grapheme',
  ),
  'prev' => 
  array (
    0 => 'function.grapheme-strstr.php',
    1 => 'grapheme_strstr',
  ),
  'next' => 
  array (
    0 => 'ref.intl.idn.php',
    1 => 'Функції IDN',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/grapheme/grapheme-substr.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.grapheme-substr" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">grapheme_substr</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">grapheme_substr</span> &mdash; <span class="dc-title">Return part of a string</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.grapheme-substr-description">
  <h3 class="title">Опис</h3>
  <p class="para">Процедурний стиль</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>grapheme_substr</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">$offset</code></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.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>): <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">
   Return part of a string
  </p> 
 </div>


 <div class="refsect1 parameters" id="refsect1-function.grapheme-substr-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       The input string. Must be valid UTF-8. 
      </p>
     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       Start position in default grapheme units.
       If <code class="parameter">offset</code> is non-negative, the returned string will start at the
       <code class="parameter">offset</code>&#039;th position in <code class="parameter">string</code>, counting from zero. If <code class="parameter">offset</code> is negative,
       the returned string will start at the <code class="parameter">offset</code>&#039;th grapheme unit from the 
       end of string.
      </p>
     </dd>
    
    
     <dt><code class="parameter">length</code></dt>
     <dd>
      <p class="para">
       Length in grapheme units.
       If <code class="parameter">length</code> is given and is positive, the string returned will contain
       at most <code class="parameter">length</code> grapheme units beginning from <code class="parameter">offset</code> (depending on the 
       length of string). If <code class="parameter">length</code> is given and is negative, then
       that many grapheme units will be omitted from the end of string (after the
       start position has been calculated when <code class="parameter">offset</code> is negative). If <code class="parameter">offset</code>
       denotes a position beyond this truncation, an empty string will be returned.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

   
 
 <div class="refsect1 returnvalues" id="refsect1-function.grapheme-substr-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns the extracted part of <code class="parameter">string</code>,  або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.grapheme-substr-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       The function now consistently clamps out-of-bounds offsets to the string boundary.
       Previously, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> was returned instead of the empty string in some cases.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.grapheme-substr-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>grapheme_substr()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$char_a_ring_nfd </span><span style="color: #007700">= </span><span style="color: #DD0000">"a\xCC\x8A"</span><span style="color: #007700">;  </span><span style="color: #FF8000">// 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"<br /></span><span style="color: #0000BB">$char_o_diaeresis_nfd </span><span style="color: #007700">= </span><span style="color: #DD0000">"o\xCC\x88"</span><span style="color: #007700">; </span><span style="color: #FF8000">// 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"<br /><br /></span><span style="color: #007700">print </span><span style="color: #0000BB">urlencode</span><span style="color: #007700">(</span><span style="color: #0000BB">grapheme_substr</span><span style="color: #007700">( </span><span style="color: #DD0000">"ao" </span><span style="color: #007700">. </span><span style="color: #0000BB">$char_a_ring_nfd </span><span style="color: #007700">. </span><span style="color: #DD0000">"bc" </span><span style="color: #007700">. </span><span style="color: #0000BB">$char_o_diaeresis_nfd </span><span style="color: #007700">. </span><span style="color: #DD0000">"O"</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, -</span><span style="color: #0000BB">1 </span><span style="color: #007700">));<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">a%CC%8Abco%CC%88</pre>
</div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.grapheme-substr-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.grapheme-extract.php" class="function" rel="rdfs-seeAlso">grapheme_extract()</a> - Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8</span></li>
    <li>
     <a href="http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries" class="link external">&raquo;&nbsp;
      Unicode Text Segmentation: Grapheme Cluster Boundaries
     </a>
    </li>
   </ul>
  </p>
 </div>

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