Text_Diff::reverse

Advertisement

Summery Summery

Computes a reversed diff.

Syntax Syntax

Text_Diff::reverse()

Description Description

Example:

$diff = new Text_Diff($lines1, $lines2);
$rev = $diff->reverse();

Return Return

(Text_Diff) A Diff object representing the inverse of the original diff. Note that we purposely don't return a reference here, since this essentially is a clone() method.

Source Source

File: wp-includes/Text/Diff.php

    function reverse()
    {
        if (version_compare(zend_version(), '2', '>')) {
            $rev = clone($this);
        } else {
            $rev = $this;
        }
        $rev->_edits = array();
        foreach ($this->_edits as $edit) {
            $rev->_edits[] = $edit->reverse();
        }
        return $rev;
    }

Advertisement

Advertisement

Leave a Reply