★ wanayoo — archive 1999 http://www.php.net/manual/it/function.soundex.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Strings
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageFrench version of this pageHungarian version of this page
Strings
* AddCSlashes
* AddSlashes
* bin2hex
* Chop
* Chr
* chunk_split
* convert_cyr_string
* count_chars
* crypt
* echo
* explode
* flush
* get_html_translation_table
* get_meta_tags
* htmlentities
* htmlspecialchars
* implode
* join
* ltrim
* md5
* Metaphone
* nl2br
* Ord
* parse_str
* print
* printf
* quoted_printable_decode
* QuoteMeta
* rawurldecode
* rawurlencode
* setlocale
* similar_text
* soundex
* sprintf
* strcasecmp
* strchr
* strcmp
* strcspn
* strip_tags
* StripCSlashes
* StripSlashes
* stristr
* strlen
* strpos
* strrchr
* str_repeat
* strrev
* strrpos
* strspn
* strstr
* strtok
* strtolower
* strtoupper
* str_replace
* strtr
* substr
* substr_replace
* trim
* ucfirst
* ucwords
Manual: soundex
View the source code for this pageSearch the site



Previous page
 similar_text
 Updated
Sun, 06 Aug 2000
sprintf 
Next page


soundex

(PHP3 , PHP4 )

soundex -- Calculate the soundex key of a string

Description

string soundex (string str)

Calculates the soundex key of str.

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. This soundex function returns a string 4 characters long, starting with a letter.

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.

Esempio 1. Soundex Examples


soundex ("Euler") == soundex ("Ellery") == 'E460';
soundex ("Gauss") == soundex ("Ghosh") == 'G200';
soundex ("Knuth") == soundex ("Kant") == 'H416';
soundex ("Lloyd") == soundex ("Ladd") == 'L300';
soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222';
      


User Contributed Notes: soundex


benoit.sibaud@cnet.francetelecom.fr
18-May-1999 03:33
There is a mistake in examples :
soundex("Euler") == soundex("Ellery") == 'E460';
soundex("Gauss") == soundex("Ghosh") == 'G200';
-->soundex("Knuth") == soundex("Kant") == 'H416';<--
soundex("Lloyd") == soundex("Ladd") == 'L300';
soundex("Lukasiewicz") == soundex("Lissajous") == 'L222';

Correct examples from http://www.mathematik.uni-ulm.de/help/perl5/doc/Text/Soundex.html (I supposed it's Knuth examples ?) :
Euler, Ellery -> E460
Gauss, Ghosh -> G200
* Hilbert, Heilbronn -> H416 *
* Knuth, Kant -> K530 *
Lloyd, Ladd -> L300
Lukasiewicz, Lissajous -> L222



benoit.sibaud@cnet.francetelecom.fr
15-Jun-1999 07:06
Error in soundex examples. Already signaled but seems no correction have been done.
One line of examples has been cut. Check the original Knuth examples.



cap@capsi.cx
13-Dec-1999 07:16
soundex() unfortunately is very sensitive about the first character. It is not possible to use it and have Clansy and Klansy return the same value. If you want to do a phonetic search on such names you will still need to write a routine to evaluate C452 as being similar to K452.



thales@planet.nl
28-Dec-1999 05:06
Is the outcome of the equation to be interpreted like, the higher the number after the letter the bigger the difference in prononciation?


thales@planet.nl
03-Jan-2000 05:21
all people who use soundex look out!
soundex can 't get the code right for an string in an array, concate the array in a string!



spam-php@sporty.org
08-Aug-2000 12:29
A note on the last statement, the prototype asks for a string type. Do not expect it to do arrays.


 About Notes


Previous page
 similar_text
 Updated
Sun, 06 Aug 2000
sprintf 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.