1 diff.inc Diff::lcs()

Compute the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposed.

Return value

int The length of the LCS.:

File

core/includes/diff.inc, line 693
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Class

Diff
Class representing a 'diff' between two sequences of strings.

Code

function lcs() {
  $lcs = 0;
  foreach ($this->edits as $edit) {
    if ($edit->type == 'copy') {
      $lcs += count($edit->orig);
    }
  }

  return $lcs;
}