note 17425 deleted from function.soundex by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 23:36:35 +0000 |
| Subject: | note 17425 deleted from function.soundex by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22352@lists.php.net to get a copy of this message | ||
Thanks, but please stop the mails! Here is my production code:
$SEARCHWORD="WHAT YOU SEARCH FOR";
$YOUR_ROW="YOUR_ROW";
$Word=ereg_replace(" ","",$SEARCHWORD);
$SoundexCode=soundex(substr($Word,0,6));
if(strlen($Word)>4)
{
for($i=3;$i<strlen($Word);$i+=3)$SoundexCode.=ereg_replace("[A-Z]","",soundex(substr($Word,$i,4)));
for($n=0;$n<strlen($SoundexCode);$n++)
{
for($i=0;$i<9;$i++)$SoundexCode=ereg_replace("$i$i","$i",$SoundexCode);
$SoundexCode=ereg_replace("0","",$SoundexCode);
}
}
}
$sql="SELECT * FROM your_table WHERE SOUNDEX($YOUR_ROW) LIKE '%$SoundexCode%' OR
$YOUR_ROW LIKE '%$SEARCHWORD%'";