Diff
This Class implements the Difference Algorithm published in "An O(ND) Difference Algorithm and its Variations" by Eugene Myers Algorithmica Vol. 1 No. 2, 1986, p 251.
Table of Contents
Methods
- getDiffHtml() : string
- Function finds the difference between two versions of text and creates html output with highlighted edits to transform text from first to second version.
- getDiffScript() : array<string|int, mixed>
- Function compares two arrays and creates edit script, that is required to transform array $a to array $b
Methods
getDiffHtml()
Function finds the difference between two versions of text and creates html output with highlighted edits to transform text from first to second version.
public
getDiffHtml(string $a, string $b) : string
Parameters
- $a : string
-
First version of text to be compared.
- $b : string
-
Second version of text to be compared.
Return values
stringgetDiffScript()
Function compares two arrays and creates edit script, that is required to transform array $a to array $b
public
getDiffScript(array<string|int, mixed> $a, array<string|int, mixed> $b) : array<string|int, mixed>
Parameters
- $a : array<string|int, mixed>
-
First array to be compared.
- $b : array<string|int, mixed>
-
Second array to be compared.
Return values
array<string|int, mixed> —Array of edit steps to transform array $a to array $b. Each step is an array with keys: