A class containing functions for computing diffs and formatting the output.
Created by Stephen Morley - http://stephenmorley.org/ - and released under the terms of the CC0 1.0 Universal legal code: http://creativecommons.org/publicdomain/zero/1.0/legalcode
| package | Default |
|---|
compare(string $string1, string $string2, boolean $compareCharacters = false)
The return value is an array, each of whose values is an array containing two values: a line (or character, if $compareCharacters is true), and one of the constants DIFF::UNMODIFIED (the line or character is in both strings), DIFF::DELETED (the line or character is only in the first string), and DIFF::INSERTED (the line or character is only in the second string).
stringthe first string
stringthe second string
booleantrue to compare characters, and false to compare lines; this optional parameter defaults to false
computeTable(mixed $sequence1, mixed $sequence2, mixed $start, mixed $end1, mixed $end2)
mixedthe first sequence
mixedthe second sequence
mixedthe starting index
mixedthe ending index for the first sequence
mixedthe ending index for the second sequence
generatePartialDiff(mixed $table, mixed $sequence1, mixed $sequence2, mixed $start)
mixedthe table returned by the computeTable function
mixedthe first sequence
mixedthe second sequence
mixedthe starting index
DELETED = 1
INSERTED = 2
UNMODIFIED = 0