'Damerau-Levenshtein php

I'm searching for an implementations of the Damerau–Levenshtein algorithm for PHP, but it seems that I can't find anything with my friend google. So far I have to use PHP implemented Levenshtein (without Damerau transposition, which is very important), or get a original source code (in C, C++, C#, Perl) and write (translate) it to PHP.

Does anybody have any knowledge of a PHP implementation ?

I'm using soundex and double metaphone for a "Did you mean:" extension on my corporate intranet, and I want to implement the Damerau–Levenshtein algorithm to help me sort the results better. Something similar to this idea: http://www.briandrought.com/blog/?p=66, my implementation is similar to the first 5 steps.



Solution 1:[1]

Have a look at our implementation (with tests and documentation).

Solution 2:[2]

How about just using the built in php function... ?

http://php.net/manual/en/function.levenshtein.php

int levenshtein ( string $str1 , string $str2 )


int levenshtein ( string $str1 , string $str2 , int $cost_ins , int $cost_rep , int $cost_del )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tersmitten
Solution 2 John Peterson