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).
string
the first string
string
the second string
boolean
true 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)
mixed
the first sequence
mixed
the second sequence
mixed
the starting index
mixed
the ending index for the first sequence
mixed
the ending index for the second sequence
generatePartialDiff(mixed $table, mixed $sequence1, mixed $sequence2, mixed $start)
mixed
the table returned by the computeTable function
mixed
the first sequence
mixed
the second sequence
mixed
the starting index
DELETED = 1
INSERTED = 2
UNMODIFIED = 0