<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.metaphone.php',
    1 => 'metaphone',
    2 => 'Berechnet den Metaphone-Schl&uuml;ssel eines Strings',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.md5-file.php',
    1 => 'md5_file',
  ),
  'next' => 
  array (
    0 => 'function.money-format.php',
    1 => 'money_format',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/strings/functions/metaphone.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.metaphone" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">metaphone</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">metaphone</span> &mdash; <span class="dc-title">Berechnet den Metaphone-Schlüssel eines Strings</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.metaphone-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>metaphone</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">$max_phonemes</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Errechnet den Metaphone-Schlüssel von <code class="parameter">string</code>.
  </p>
  <p class="para">
   Genau wie <span class="function"><a href="function.soundex.php" class="function">soundex()</a></span> berechnet metaphone den gleichen
   Schlüssel für ähnlich klingende Wörter. Die Metaphone-Funktion arbeitet
   genauer als <span class="function"><a href="function.soundex.php" class="function">soundex()</a></span>, da sie die Grundregeln der
   englischen Aussprache kennt. Die durch metaphone erzeugten Schlüssel sind
   von variabler Länge.
  </p>
  <p class="para">
   Der Metaphone-Algorithmus wurde von Lawrence Philips &lt;lphilips at verity
   dot com&gt; entwickelt und in [&quot;Practical Algorithms for Programmers&quot;,
   Binstock &amp; Rex, Addison Wesley, 1995] beschrieben.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.metaphone-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       Die Eingabezeichenkette.
      </p>
     </dd>
    
    
     <dt><code class="parameter">max_phonemes</code></dt>
     <dd>
      <p class="para">
       Dieser Parameter begrenzt den zurückgegebenen Metaphone-Schlüssel auf
       die Länge von <code class="parameter">max_phonemes</code>
       <em>Zeichen</em>. Die resultierenden Phoneme werden jedoch
       immer vollständig umgeschrieben, so dass die resultierende
       Zeichenkettenlänge etwas größer sein kann, als
       <code class="parameter">max_phonemes</code>. Der Standardwert von
       <code class="literal">0</code> bedeutet keine Begrenzung.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.metaphone-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt den Metaphon-Schlüssel als Zeichenkette zurück.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.metaphone-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       Die Funktion gab bei Auftreten eines Fehlers <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurück.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.metaphone-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="metaphone.example.basic">
    <p><strong>Beispiel #1 Einfaches <span class="function"><strong>metaphone()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">metaphone</span><span style="color: #007700">(</span><span style="color: #DD0000">'programming'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">metaphone</span><span style="color: #007700">(</span><span style="color: #DD0000">'programmer'</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="annotation-interactive examplescode"><pre class="examplescode">string(7) &quot;PRKRMNK&quot;
string(6) &quot;PRKRMR&quot;</pre>
</div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="metaphone.example.phonemes">
    <p><strong>Beispiel #2 Verwendung des <code class="parameter">max_phonemes</code>-Parameters</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">metaphone</span><span style="color: #007700">(</span><span style="color: #DD0000">'programming'</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">metaphone</span><span style="color: #007700">(</span><span style="color: #DD0000">'programmer'</span><span style="color: #007700">, </span><span style="color: #0000BB">5</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="annotation-interactive examplescode"><pre class="examplescode">string(5) &quot;PRKRM&quot;
string(5) &quot;PRKRM&quot;</pre>
</div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="metaphone.example.phonemes-overlong">
    <p><strong>Beispiel #3 Verwendung des <code class="parameter">max_phonemes</code>-Parameters</strong></p>
    <div class="example-contents"><p>
     In diesem Beispiel soll <span class="function"><strong>metaphone()</strong></span> eine Zeichenkette
     mit fünf Zeichen erzeugen, aber dazu müsste das letzte Phonem getrennt
     werden (<code class="literal">&#039;x&#039;</code> soll in <code class="literal">&#039;KS&#039;</code>
     umgeschrieben werden). Daher gibt die Funktion eine Zeichenkette mit
     sechs Zeichen zurück.
    </p></div>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">metaphone</span><span style="color: #007700">(</span><span style="color: #DD0000">'Asterix'</span><span style="color: #007700">, </span><span style="color: #0000BB">5</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="annotation-interactive examplescode"><pre class="examplescode">string(6) &quot;ASTRKS&quot;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.metaphone-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.levenshtein.php" class="function" rel="rdfs-seeAlso">levenshtein()</a> - Berechnet die Levenshtein-Distanz zwischen zwei Strings</span></li>
    <li><span class="function"><a href="function.similar-text.php" class="function" rel="rdfs-seeAlso">similar_text()</a> - Berechnet die &Auml;hnlichkeit zweier Zeichenketten</span></li>
    <li><span class="function"><a href="function.soundex.php" class="function" rel="rdfs-seeAlso">soundex()</a> - Berechnet die Laut-&Auml;hnlichkeit eines Strings</span></li>
   </ul>
  </p>
 </div>

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