Skip to content

Instantly share code, notes, and snippets.

View coreynorthcutt's full-sized avatar

Corey Northcutt coreynorthcutt

View GitHub Profile
@coreynorthcutt
coreynorthcutt / gist:14d496600e8d1a4e95ac0c3505478f94
Created January 17, 2018 00:47
Levenshtein distance comparison
/*
* Ideal Levenshtein comparison from 0 to 100: 0 being the most similar, 100 being the least
*/
function levenshteinDistance($str1, $str2) {
$len1 = mb_strlen($str1);
$len2 = mb_strlen($str2);
// strip common prefix
$i = 0;
do {