Name

levenshtein

Synopsis

int levenshtein(string one, string two[, int insert, int replace, int delete])
int levenshtein(string one, string two[, mixed callback])

Calculates the Levenshtein distance between two strings; this is the number of characters you have to replace, insert, or delete to transform one into two. By default, replacements, inserts, and deletes have the same cost, but you can specify different costs with insert, replace, and delete. In the second form, you provide a callback to calculate the cost of an operation.

Get Programming PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.