Latest Articles
 by awuehr on 11-10-2008 in Tips & Tricks by Village Idiot on 11-04-2008 in Classes & Objects by codefreek on 10-23-2008 in Basic by wiifanatic on 09-12-2008 in Security & Permissions by drewbee on 07-03-2008 in Tips & Tricks
 IRC Channel
 Join the friendly bunch on IRC... (#TalkPHP on Freenode) ...Also available via a web interface. See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
 Associates
 Associates
 TalkPHP » SoundEX Algorithm: Knuth
 08-09-2009, 06:36 PM #1 (permalink) The Addict     Join Date: Jun 2008 Posts: 335 Thanks: 2 SoundEX Algorithm: Knuth Well I needed to employ the soundex algorithm for some simple search techniques in a script I'm writing and without doing research I started writing my own class to calculate the soundex...and than found the soundex function when I typed out SoundEX into my IDE...So I figured I'd atleast post it up here to share with people who'd be interested. php Code: ` 0  )        {            \$String = strtolower(\$String);            \$outPut .= \$String{0};                        for( \$i = 1; \$i < strlen(\$String) && strlen(\$outPut) < 4; \$i++ )            {                \$c = self::encode(\$String{\$i});                                switch( \$String{\$i -1 } )                {                    case 'a':                        case 'e':                        case 'i':                        case 'o':                        case 'u':                            \$outPut .= \$c;                            break;                        case 'h':                        case 'w':                        default:                            if(strlen(\$outPut) == 1 )                             {                                if(self::encode(\$outPut[strlen(\$outPut)-1]) != \$c)                                    \$outPut .= \$c;                            } else {                                if(\$outPut[strlen(\$outPut)-1] != \$c)                                    \$outPut .= \$c;                            }                                                        break;                }            }                        for( \$i = strlen(\$outPut); \$i < 4; ++\$i )            {                \$outPut .= "0";            }                        return (string)\$outPut;        }    }}` __________________ My Blog

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On

 Similar Threads Thread Thread Starter Forum Replies Last Post Pixelate algorithm using GD Kalle Script Giveaway 9 06-27-2009 12:36 AM Google-News-Like Headline Grouping Algorithm serversphere Advanced PHP Programming 0 02-29-2008 05:21 PM hash() algorithm info script RobertK Script Giveaway 4 01-09-2008 03:00 PM

All times are GMT. The time now is 01:01 AM.