added documentation for the newly added function levdist()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@24800 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Hartmut Holzgraefe 2000-05-23 14:12:34 +00:00
parent 07ac9be70a
commit 2e48d77ee7

View file

@ -750,6 +750,45 @@ $colon_separated = implode (":", $array);
</refsect1>
</refentry>
<refentry id="function.levdist">
<refnamediv>
<refname>ltrim</refname>
<refpurpose>
Calculate Levenshtein distance between two strings
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>levdist</function></funcdef>
<paramdef>string <parameter>str1</parameter></paramdef>
<paramdef>string <parameter>str2</parameter></paramdef>
</funcsynopsis>
<para>
This function return the Levenshtein-Distance between the
two argument strings or -1, if one of the argument strings
is longer than the limit of 255 characters.
</para>
<para>
The Levenshtein distance is defined as the minimal number
of characters you have to replace, insert or delete to
transform <parameter>str1</parameter> into
<parameter>str2</parameter>.
The complexity of the algorithm is <literal>O(m*n)</literal>,
where <literal>n</literal> and <literal>m</literal> are the
length of <parameter>str1</parameter> and
<parameter>str2</parameter> (rather good when compared to
<function>similar_text</function>, which is O(max(n,m)**3),
but still expensive).
</para>
<para>
See also <function>soundex</function>,
<function>similar_text</function>
and <function>metaphone</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ltrim">
<refnamediv>
<refname>ltrim</refname>