Calculate the most similar string in an array

Didn’t know you could do this, but PHP supports functions for finding the ‘Levenshtein’ algorithm. Given an array of strings, and a target, you can easily find the string in the array most like (though not necessarily the same as) the target.

Calculate the most similar string in an array

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.