reference/strings/functions/soundex.xml
45042fef652f1b4e904e809fcbfcf31f6c60670b
45042fef652f1b4e904e809fcbfcf31f6c60670b
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.soundex">
3
+
<refentry xml:id="function.soundex" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>soundex</refname>
6
6
<refpurpose>Calculate the soundex key of a string</refpurpose>
...
...
@@ -10,17 +10,16 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>soundex</methodname>
13
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
-
Calculates the soundex key of <parameter>str</parameter>.
16
+
Calculates the soundex key of <parameter>string</parameter>.
17
17
</para>
18
18
<para>
19
19
Soundex keys have the property that words pronounced similarly
20
20
produce the same soundex key, and can thus be used to simplify
21
21
searches in databases where you know the pronunciation but not
22
-
the spelling. This soundex function returns a string 4 characters
23
-
long, starting with a letter.
22
+
the spelling.
24
23
</para>
25
24
<para>
26
25
This particular soundex function is one described by Donald Knuth
...
...
@@ -34,7 +33,7 @@
34
33
<para>
35
34
<variablelist>
36
35
<varlistentry>
37
-
<term><parameter>str</parameter></term>
36
+
<term><parameter>string</parameter></term>
38
37
<listitem>
39
38
<para>
40
39
The input string.
...
...
@@ -48,10 +47,35 @@
48
47
<refsect1 role="returnvalues">
49
48
&reftitle.returnvalues;
50
49
<para>
51
-
Returns the soundex key as a string.
50
+
Returns the soundex key as a &string; with four characters.
51
+
If at least one letter is contained in <parameter>string</parameter>, the returned
52
+
string starts with a letter. Otherwise <literal>"0000"</literal> is returned.
52
53
</para>
53
54
</refsect1>
54
55
56
+
<refsect1 role="changelog">
57
+
&reftitle.changelog;
58
+
<informaltable>
59
+
<tgroup cols="2">
60
+
<thead>
61
+
<row>
62
+
<entry>&Version;</entry>
63
+
<entry>&Description;</entry>
64
+
</row>
65
+
</thead>
66
+
<tbody>
67
+
<row>
68
+
<entry>8.0.0</entry>
69
+
<entry>
70
+
Prior to this version, calling the function with an empty string returned &false;
71
+
for no particular reason.
72
+
</entry>
73
+
</row>
74
+
</tbody>
75
+
</tgroup>
76
+
</informaltable>
77
+
</refsect1>
78
+
55
79
<refsect1 role="examples">
56
80
&reftitle.examples;
57
81
<para>
...
...
@@ -60,6 +84,8 @@
60
84
<programlisting role="php">
61
85
<![CDATA[
62
86
<?php
87
+
echo soundex("Euler"), PHP_EOL, soundex("Ellery"), PHP_EOL;
88
+
63
89
soundex("Euler") == soundex("Ellery"); // E460
64
90
soundex("Gauss") == soundex("Ghosh"); // G200
65
91
soundex("Hilbert") == soundex("Heilbronn"); // H416
...
...
@@ -85,7 +111,6 @@ soundex("Lukasiewicz") == soundex("Lissajous"); // L222
85
111
</refsect1>
86
112
87
113
</refentry>
88
-
89
114
<!-- Keep this comment at the end of the file
90
115
Local variables:
91
116
mode: sgml
92
117