Plain PHP implementation of the Levenshtein distance.
- No 255 characters limit
- Works with UTF-8
- Accepts float as custom costs
Via Composer
$ composer require gordonlesti/levenshtein
use GordonLesti\Levenshtein\Levenshtein;
With default default costs.
$levDist = Levenshtein::levenshtein("AC", "ABAA");
With insert cost 7.7
, replace cost 9.4
and delete cost 2.5
.
$levDist = Levenshtein::levenshtein("ACCB", "BC", 7.7, 9.4, 2.5);
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.