src/Diff.php
public function prettyHtml()
    {
        $diffs = $this->getChanges();

        $html = '';
        foreach ($diffs as $change) {
            $op = $change[0];
            $data = $change[1];
            $text = str_replace(array(
                '&', '<', '>', "\n",
            ), array(
                '&amp;', '&lt;', '&gt;', '&para;<br>',
            ), $data);

            if ($op == self::INSERT) {
                $html .= '<ins style="background:#e6ffe6;">' . $text . '</ins>';
            } elseif ($op == self::DELETE) {
                $html .= '<del style="background:#ffe6e6;">' . $text . '</del>';
            } else {
                $html .= '<span>' . $text . '</span>';
            }
        }

        return $html;
    }
public function prettyHtml()
    {
        $diffs = $this->getChanges();

        $html = '';
        foreach ($diffs as $change) {
            $op = $change[0];
            $data = $change[1];
            $text = str_replace(array(
                '&', '<', '>', "\n",
            ), array(
                '&amp;', '&lt;', '&gt;', '&para;<br>',
            ), $data);

            if ($op == self::INSERT) {
                $html .= '<ins style="background:#e6ffe6;">' . $text . '</ins>';
            } elseif ($op == self::DELETE) {
                $html .= '<del style="background:#ffe6e6;">' . $text . '</del>';
            } else {
                $html .= '<span>' . $text . '</span>';
            }
        }

        return $html;
    }
Convert a diff array into a pretty HTML report.

@return string HTML representation.