Name
levenshtein
Synopsis
int levenshtein(stringone
, stringtwo
[, intinsert
, intreplace
, intdelete
])int levenshtein(stringone
, stringtwo
[, mixedcallback
])
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, 2nd Edition 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.