<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.collator.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'collator.setstrength.php',
    1 => 'Collator::setStrength',
    2 => 'Set collation strength',
  ),
  'up' => 
  array (
    0 => 'class.collator.php',
    1 => 'Collator',
  ),
  'prev' => 
  array (
    0 => 'collator.setattribute.php',
    1 => 'Collator::setAttribute',
  ),
  'next' => 
  array (
    0 => 'collator.sort.php',
    1 => 'Collator::sort',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/collator/set-strength.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="collator.setstrength" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Collator::setStrength</h1>
  <h1 class="refname">collator_set_strength</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">Collator::setStrength</span> -- <span class="refname">collator_set_strength</span> &mdash; <span class="dc-title">Set collation strength</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-collator.setstrength-description">
  <h3 class="title">Beschreibung</h3>
  <p class="para">
   Objektorientierter Stil
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Collator::setStrength</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$strength</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Prozeduraler Stil
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>collator_set_strength</strong></span>(<span class="methodparam"><span class="type"><a href="class.collator.php" class="type Collator">Collator</a></span> <code class="parameter">$object</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$strength</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   The
   <a href="https://icu.unicode.org/" class="link external">&raquo;&nbsp;ICU</a>
   Collation Service supports many levels of comparison (named &quot;Levels&quot;, but
   also known as &quot;Strengths&quot;). Having these categories enables ICU to sort
   strings precisely according to local conventions. However, by allowing the
   levels to be selectively employed, searching for a string in text can be
   performed with various matching conditions.
  </p>
  <p class="para">
   <ol type="1">
    <li class="listitem">
     <p class="para"> 
      <em>Primary Level</em>:
      Typically, this is used to denote differences between base characters
      (for example, &quot;a&quot; &lt; &quot;b&quot;). It is the strongest difference. For
      example, dictionaries are divided into different sections by base
      character. This is also called the <code class="literal">level 1</code> strength.
     </p>
    </li>
    <li class="listitem">
     <p class="para"> 
      <em>Secondary Level</em>:
      Accents in the characters are considered secondary differences (for
      example, &quot;as&quot; &lt; &quot;às&quot; &lt; &quot;at&quot;). Other differences between letters
      can also be considered secondary differences, depending on the language.
      A secondary difference is ignored when there is a primary difference
      anywhere in the strings. This is also called the <code class="literal">level 2</code> strength.
      <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
       <p class="para">
        Note: In some languages (such as Danish), certain accented letters are
        considered to be separate base characters. In most languages, however,
        an accented letter only has a secondary difference from the unaccented
        version of that letter.
       </p>
      </p></blockquote>
     </p>
    </li>
    <li class="listitem">
     <p class="para"> 
      <em>Tertiary Level</em>:
      Upper and lower case differences in characters are distinguished at
      the tertiary level (for example, &quot;ao&quot; &lt; &quot;Ao&quot; &lt; &quot;aò&quot;). In addition,
      a variant of a letter differs from the base form on the tertiary level
      (such as &quot;a&quot; and &quot;𝒶&quot;). Another example is the difference between large
      and small Kana. A tertiary difference is ignored when there is a primary
      or secondary difference anywhere in the strings. This is also called the
      <code class="literal">level 3</code> strength.
     </p>
    </li>
    <li class="listitem">
     <p class="para"> 
      <em>Quaternary Level</em>:
      When punctuation is ignored (see Ignoring Punctuations ) at levels 1-3,
      an additional level can be used to distinguish words with and without
      punctuation (for example, &quot;ab&quot; &lt; &quot;a-b&quot; &lt; &quot;aB&quot;). This difference is
      ignored when there is a primary, secondary or tertiary difference. This
      is also known as the <code class="literal">level 4</code> strength. The quaternary level should only
      be used if ignoring punctuation is required or when processing Japanese
      text (see Hiragana processing).
     </p>
    </li>
    <li class="listitem">
     <p class="para"> 
      <em>Identical Level</em>:
      When all other levels are equal, the identical level is used as a
      tiebreaker. The Unicode code point values of the NFD form of each string
      are compared at this level, just in case there is no difference at
      levels 1-4. For example, Hebrew cantillation marks are only distinguished
      at this level. This level should be used sparingly, as only code point
      values differences between two strings is an extremely rare occurrence.
      Using this level substantially decreases the performance for both
      incremental comparison and sort key generation (as well as increasing
      the sort key length). It is also known as <code class="literal">level 5</code> strength.
     </p>
    </li>
   </ol>
  </p>
  <p class="para">
   For example, people may choose to ignore accents or ignore accents and case
   when searching for text. Almost all characters are distinguished by the
   first three levels, and in most locales the default value is thus Tertiary.
   However, if Alternate is set to be Shifted, then the Quaternary strength
   can be used to break ties among whitespace, punctuation, and symbols that
   would otherwise be ignored. If very fine distinctions among characters are
   required, then the Identical strength can be used (for example, Identical
   Strength distinguishes between the Mathematical Bold Small A and the
   Mathematical Italic Small A.). However, using levels higher than Tertiary
   the Identical strength result in significantly longer sort keys, and slower
   string comparison performance for equal strings.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-collator.setstrength-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">object</code></dt>
     <dd>
      <p class="para">
       <span class="classname"><a href="class.collator.php" class="classname">Collator</a></span> object.
      </p>
     </dd>
    
    
     <dt><code class="parameter">strength</code></dt>
     <dd>
      <p class="para">Strength to set.</p>
      <p class="para">
       Possible values are:
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.primary">Collator::PRIMARY</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.secondary">Collator::SECONDARY</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.tertiary">Collator::TERTIARY</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.quaternary">Collator::QUATERNARY</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.identical">Collator::IDENTICAL</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="class.collator.php#collator.constants.default-strength">Collator::DEFAULT_STRENGTH</a></code></strong>
         </p>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-collator.setstrength-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt immer <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-collator.setstrength-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>collator_set_strength()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$arr  </span><span style="color: #007700">= array( </span><span style="color: #DD0000">'aò'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Ao'</span><span style="color: #007700">, </span><span style="color: #DD0000">'ao' </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$coll </span><span style="color: #007700">= </span><span style="color: #0000BB">collator_create</span><span style="color: #007700">( </span><span style="color: #DD0000">'en_US' </span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Sort array using default strength.<br /></span><span style="color: #0000BB">collator_sort</span><span style="color: #007700">( </span><span style="color: #0000BB">$coll</span><span style="color: #007700">, </span><span style="color: #0000BB">$arr </span><span style="color: #007700">); <br /></span><span style="color: #0000BB">var_export</span><span style="color: #007700">( </span><span style="color: #0000BB">$arr </span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Sort array using primary strength.<br /></span><span style="color: #0000BB">collator_set_strength</span><span style="color: #007700">( </span><span style="color: #0000BB">$coll</span><span style="color: #007700">, </span><span style="color: #0000BB">Collator</span><span style="color: #007700">::</span><span style="color: #0000BB">PRIMARY </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">collator_sort</span><span style="color: #007700">( </span><span style="color: #0000BB">$coll</span><span style="color: #007700">, </span><span style="color: #0000BB">$arr </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_export</span><span style="color: #007700">( </span><span style="color: #0000BB">$arr </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array (
  0 =&gt; &#039;ao&#039;,
  1 =&gt; &#039;Ao&#039;,
  2 =&gt; &#039;aò&#039;,
)
array (
  0 =&gt; &#039;aò&#039;,
  1 =&gt; &#039;Ao&#039;,
  2 =&gt; &#039;ao&#039;,
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-collator.setstrength-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="class.collator.php#intl.collator-constants" class="link"><span class="classname"><a href="class.collator.php" class="classname">Collator</a></span> constants</a></li>
    <li><span class="function"><a href="collator.getstrength.php" class="function" rel="rdfs-seeAlso">collator_get_strength()</a> - Get current collation strength</span></li>
   </ul>
  </p>
 </div>

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