Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 8970

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Enumerate all code points with their Unicode general categories</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlchar.enumcharnames.html">IntlChar::enumCharNames</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlchar.foldcase.html">IntlChar::foldCase</a></div>
 <div class="up"><a href="class.intlchar.html">IntlChar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intlchar.enumchartypes" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlChar::enumCharTypes</h1>
  <p class="verinfo">(PHP 7)</p><p class="refpurpose"><span class="refname">IntlChar::enumCharTypes</span> &mdash; <span class="dc-title">Enumerate all code points with their Unicode general categories</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlchar.enumchartypes-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>IntlChar::enumCharTypes</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>
   )</div>

  <p class="para rdfs-comment">
   Enumerates efficiently all code points with their Unicode general categories. This is useful for building data
   structures, for enumerating all assigned code points, etc.
  </p>
  <p class="para">
   For each contiguous range of code points with a given general category (&quot;character type&quot;), the
   <code class="parameter">callback</code> function is called. Adjacent ranges have different types. The Unicode Standard
   guarantees that the numeric value of the type is 0..31.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlchar.enumchartypes-parameters">
  <h3 class="title">Parameters</h3>
  <dl>

   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
      The function that is to be called for each contiguous range of code points with the same general category.
      The following three arguments will be passed into it:
      <ul class="simplelist">
       <li class="member"><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> <em>$start</em> - The starting code point of the range</li>
       <li class="member"><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> <em>$end</em> - The ending code point of the range</li>
       <li class="member"><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> <em>$name</em> - The category type (one of the <em>IntlChar::CHAR_CATEGORY_*</em> constants)</li>
      </ul>
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlchar.enumchartypes-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   No value is returned.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-intlchar.enumchartypes-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-3202">
   <p><strong>Example #1 Enumerating over a sample range of code points</strong></p>
   <div class="example-contents">
    <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />IntlChar</span><span style="color: #007700">::</span><span style="color: #0000BB">enumCharTypes</span><span style="color: #007700">(function(</span><span style="color: #0000BB">$start</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$end</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$type</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"U+%04x&nbsp;through&nbsp;U+%04x&nbsp;are&nbsp;in&nbsp;category&nbsp;%d\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$start</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$end</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$type</span><span style="color: #007700">);<br />});<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above example will output:</p></div>
   <div class="example-contents screen">
    <div class="cdata"><pre>
U+0000 through U+0020 are in category 15
U+0020 through U+0021 are in category 12
U+0021 through U+0024 are in category 23
U+0024 through U+0025 are in category 25
U+0025 through U+0028 are in category 23
U+0028 through U+0029 are in category 20
U+0029 through U+002a are in category 21
U+002a through U+002b are in category 23
U+002b through U+002c are in category 24
U+002c through U+002d are in category 23
U+002d through U+002e are in category 19
U+002e through U+0030 are in category 23
U+0030 through U+003a are in category 9
...
</pre></div>
   </div>
  </div>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlchar.enumcharnames.html">IntlChar::enumCharNames</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlchar.foldcase.html">IntlChar::foldCase</a></div>
 <div class="up"><a href="class.intlchar.html">IntlChar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>