class HtmlDiff (View source)

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

Constants

OLD_VAL

NEW_VAL

Properties

static $html_cleaner_class

Methods

static string
compareHtml(string|array $from, string|array $to, bool $escape = false)

Get a diff between two sets of HTML content. The result is an HTML fragment which can be added directly into the DOM. elements are used to indicate new content, and elements are used to indicate removed content.

Details

static string compareHtml(string|array $from, string|array $to, bool $escape = false)

Get a diff between two sets of HTML content. The result is an HTML fragment which can be added directly into the DOM. elements are used to indicate new content, and elements are used to indicate removed content.

Parameters

string|array $from
string|array $to
bool $escape

If true, the HTML in $from and $to will be escaped after the diff operation is performed.

Return Value

string