note 16909 deleted from function.soundex by jimw

From: Date: Sat, 08 Dec 2001 23:36:27 +0000
Subject: note 16909 deleted from function.soundex by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22350@lists.php.net to get a copy of this message
But i prefer to use the faster php soundex and adapt it for mySQL. Here is the solution and it works in german language also! function soundex2($str){ $Word=ereg_replace(" ","",$Modell); for($i=0;$i<strlen($Word);$i=$i+3)$SoundexCode.=ereg_replace("[0A-Z]","",soundex(substr($Word,$i,4))); for($n=0;$n<strlen($SoundexCode);$n++)for($i=1;$i<9;$i++)$SoundexCode=ereg_replace("$i$i","$i",$SoundexCode); return $SoundexCode; } //Example $database="YOUR_DB"; $table="YOUR_TABLE"; $row="YOUR_TABLE_ROW"; $MyText="example soundex code"; $SoundexCode=soundex2($MyText); $result=@mysql_db_query($database,"SELECT from $table WHERE SOUNDEX($row) LIKE '%$SoundexCode%'"; If you echo $SoundexCode from $MyText, you receive 251425323

« previous php.notes (#22350) next »