Oct 17, 2019 PHP
I needed a PHP library that compares strings with a Longest common subsequence algorithm. Important was the support of UTF-8 or Multibyte Strings at all.
Install gordonlesti/longest-common-subsequence
You can find the small library at Github.
Requirements
The library requires PHP 7.
Composer
The recommended installtion is via Composer.
composer require gordonlesti/longest-common-subsequenceUsage
Use GordonLesti\LongestCommonSubsequence\LongestCommonSubsequence.
use GordonLesti\LongestCommonSubsequence\LongestCommonSubsequence;Calculate the length of the longest common subsequence of two strings.
$lcsDist = LongestCommonSubsequence::lcs("DABDC", "CBDBBAC");UTF-8 support
The library supports UTF-8.
$lcsDist = LongestCommonSubsequence::lcs("ΛΕΡΒΗΔΟΗΜΑΕΞΞΘΒΗ", "ΗΝΞΛΒΑΚΛ");
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.