What is the syntax of the LEVENSHTEIN() function in php?
levenshtein(string1,string2,insert,replace,delete)
Parameters | Description |
---|---|
string1 | Required. First string to compare |
string2 | Required. Second string to compare |
insert | Optional. The cost of inserting a character. Default is 1 |
replace | Optional. The cost of replacing a character. Default is 1 |
delete | Optional. The cost of deleting a character. Default is 1 |
examples of the LEVENSHTEIN() function
Example 1. In this example, we calculate the Levenshtein distance between two strings.
<?php
echo levenshtein("Hello World","ello World");
echo "<br>";
echo levenshtein("Hello World","ello World",10,20,30);
?>