mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 23:38:56 +00:00

There is no more failure as of PHP 8.0.0, and the former behavior is already described in the changelog. We clarify the return value, though.
131 lines
3.3 KiB
XML
131 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.soundex" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>soundex</refname>
|
|
<refpurpose>Calculate the soundex key of a string</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>soundex</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Calculates the soundex key of <parameter>string</parameter>.
|
|
</para>
|
|
<para>
|
|
Soundex keys have the property that words pronounced similarly
|
|
produce the same soundex key, and can thus be used to simplify
|
|
searches in databases where you know the pronunciation but not
|
|
the spelling.
|
|
</para>
|
|
<para>
|
|
This particular soundex function is one described by Donald Knuth
|
|
in "The Art Of Computer Programming, vol. 3: Sorting And
|
|
Searching", Addison-Wesley (1973), pp. 391-392.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The input string.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the soundex key as a &string; with four characters.
|
|
If at least one letter is contained in <parameter>string</parameter>, the returned
|
|
string starts with a letter. Otherwise <literal>"0000"</literal> is returned.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
Prior to this version, calling the function with an empty string returned &false;
|
|
for no particular reason.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Soundex Examples</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
soundex("Euler") == soundex("Ellery"); // E460
|
|
soundex("Gauss") == soundex("Ghosh"); // G200
|
|
soundex("Hilbert") == soundex("Heilbronn"); // H416
|
|
soundex("Knuth") == soundex("Kant"); // K530
|
|
soundex("Lloyd") == soundex("Ladd"); // L300
|
|
soundex("Lukasiewicz") == soundex("Lissajous"); // L222
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>levenshtein</function></member>
|
|
<member><function>metaphone</function></member>
|
|
<member><function>similar_text</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|