<?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-extract.php',
    1 => 'grapheme_extract',
    2 => 'Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8',
  ),
  'up' => 
  array (
    0 => 'ref.intl.grapheme.php',
    1 => 'Функції Grapheme',
  ),
  'prev' => 
  array (
    0 => 'ref.intl.grapheme.php',
    1 => 'Функції Grapheme',
  ),
  'next' => 
  array (
    0 => 'function.grapheme-str-split.php',
    1 => 'grapheme_str_split',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/grapheme/grapheme-extract.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.grapheme-extract" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">grapheme_extract</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_extract</span> &mdash; <span class="dc-title">Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.grapheme-extract-description">
  <h3 class="title">Опис</h3>
  <p class="para">Процедурний стиль</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>grapheme_extract</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">$haystack</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">$size</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">$type</code><span class="initializer"> = <strong><code><a href="intl.constants.php#constant.grapheme-extr-count">GRAPHEME_EXTR_COUNT</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">$offset</code><span class="initializer"> = 0</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 reference">&$next</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">
   Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8. 
  </p> 
  </div>


 <div class="refsect1 parameters" id="refsect1-function.grapheme-extract-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">haystack</code></dt>
     <dd>
      <p class="para">
       String to search.
      </p>
     </dd>
    
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">
       Maximum number items - based on the <code class="parameter">type</code> - to return.
      </p>
     </dd>
    
    
     <dt><code class="parameter">type</code></dt>
     <dd>
      <p class="para">
       Defines the type of units referred to by the <code class="parameter">size</code> parameter:
      </p>
       <p class="para">
        <ul class="simplelist">
         <li>GRAPHEME_EXTR_COUNT (default) -<code class="parameter">size</code> is the number of default
         grapheme clusters to extract.</li>
         <li>GRAPHEME_EXTR_MAXBYTES -<code class="parameter">size</code> is the maximum number of bytes
         returned.</li>
         <li>GRAPHEME_EXTR_MAXCHARS - <code class="parameter">size</code> is the maximum number of UTF-8
         characters returned.</li>
        </ul>
       </p>
     </dd>
    
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       Starting position in <code class="parameter">haystack</code> in bytes - if given, it must be zero or a
       positive value that is less than or equal to the length of <code class="parameter">haystack</code> in
       bytes, or a negative value that counts from the end of <code class="parameter">haystack</code>.
       If <code class="parameter">offset</code> does not point to the first byte of a UTF-8
       character, the start position is moved to the next character boundary.
      </p>
     </dd>
    
    
     <dt><code class="parameter">next</code></dt>
     <dd>
      <p class="para">
       Reference to a value that will be set to the next starting position.
       When the call returns, this may point to the first byte position past the end of the string.
      </p>
     </dd>
    
 
   </dl>
  </p>
 </div>

   
 
 <div class="refsect1 returnvalues" id="refsect1-function.grapheme-extract-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   A string starting at offset <code class="parameter">offset</code> and ending on a default grapheme cluster
   boundary that conforms to the <code class="parameter">size</code> and <code class="parameter">type</code> specified,
    або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>

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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.1.0</td>
      <td>
       Support for negative <code class="parameter">offset</code>s has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.grapheme-extract-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>grapheme_extract()</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_extract</span><span style="color: #007700">( </span><span style="color: #0000BB">$char_a_ring_nfd </span><span style="color: #007700">. </span><span style="color: #0000BB">$char_o_diaeresis_nfd</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">GRAPHEME_EXTR_COUNT</span><span style="color: #007700">, </span><span style="color: #0000BB">2</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">o%CC%88</pre>
</div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.grapheme-extract-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.grapheme-substr.php" class="function" rel="rdfs-seeAlso">grapheme_substr()</a> - Return part of a string</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); ?>