Skip to content

String comparison / similarity doc improvements #4647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions reference/strings/functions/levenshtein.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<refname>levenshtein</refname>
<refpurpose>Calculate Levenshtein distance between two strings</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand Down Expand Up @@ -83,7 +83,7 @@
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Expand Down
12 changes: 11 additions & 1 deletion reference/strings/functions/metaphone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<refname>metaphone</refname>
<refpurpose>Calculate the metaphone key of a string</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand Down Expand Up @@ -155,6 +155,16 @@ string(6) "ASTRKS"
</para>
</refsect1><!-- }}} -->

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>levenshtein</function></member>
<member><function>similar_text</function></member>
<member><function>soundex</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
3 changes: 2 additions & 1 deletion reference/strings/functions/similar-text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<refname>similar_text</refname>
<refpurpose>Calculate the similarity between two strings</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand Down Expand Up @@ -110,6 +110,7 @@ similarity: 3 (42.857142857143 %)
<para>
<simplelist>
<member><function>levenshtein</function></member>
<member><function>metaphone</function></member>
<member><function>soundex</function></member>
</simplelist>
</para>
Expand Down
2 changes: 1 addition & 1 deletion reference/strings/functions/soundex.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<refname>soundex</refname>
<refpurpose>Calculate the soundex key of a string</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand Down
45 changes: 34 additions & 11 deletions reference/strings/functions/strcmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<refname>strcmp</refname>
<refpurpose>Binary safe string comparison</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
Expand All @@ -14,7 +14,10 @@
<methodparam><type>string</type><parameter>string2</parameter></methodparam>
</methodsynopsis>
<simpara>
Note that this comparison is case sensitive.
Note that this comparison is case sensitive. See <function>strcasecmp</function>
</simpara>
<simpara>
Note that this comparison is not locale aware. See <function>strcoll</function> or <methodname>Collator::compare</methodname>
</simpara>
</refsect1>

Expand Down Expand Up @@ -83,18 +86,38 @@ if (strcmp($var1, $var2) !== 0) {
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>strcasecmp</function></member>
<member><function>preg_match</function></member>
<member><function>substr_compare</function></member>
<member><function>strncmp</function></member>
<member><function>strstr</function></member>
<member><function>substr</function></member>
</simplelist>
<itemizedlist>
<listitem>
<simpara>Full string comparison</simpara>
<simplelist>
<member><function>strcasecmp</function></member>
<member><methodname>Collator::compare</methodname></member>
<member><function>strcoll</function></member>
</simplelist>
</listitem>
<listitem>
<simpara>Partial string comparison</simpara>
<simplelist>
<member><function>substr_compare</function></member>
<member><function>strncmp</function></member>
<member><function>strstr</function></member>
</simplelist>
</listitem>
<listitem>
<simpara>Similar / other string comparison</simpara>
<simplelist>
<member><function>preg_match</function></member>
<member><function>levenshtein</function></member>
<member><function>metaphone</function></member>
<member><function>similar_text</function></member>
<member><function>soundex</function></member>
</simplelist>
</listitem>
</itemizedlist>
</para>
</refsect1>

Expand Down