An Interest In:
Web News this Week
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
July 29, 2021 01:18 am GMT
Original Link: https://dev.to/kevinmel2000/php-damarau-levenstein-on-longest-match-substring-4kbh
PHP Damarau levenstein on Longest Match SubString
function getLongestMatchingSubstring($str1, $str2){ $len_1 = strlen($str1); $longest = ''; for($i = 0; $i < $len_1; $i++){ for($j = $len_1 - $i; $j > 0; $j--){ $sub = substr($str1, $i, $j); if (strpos($str2, $sub) !== false && strlen($sub) > strlen($longest)){ $longest = $sub; break; } } } return $longest;}
Original Link: https://dev.to/kevinmel2000/php-damarau-levenstein-on-longest-match-substring-4kbh
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To